Sending email via SMTP on zend framework

前端 未结 3 1120
没有蜡笔的小新
没有蜡笔的小新 2020-12-11 10:01
$config = array(\'auth\' => \'login\',
                \'username\' => \'****@gmail.com\',
                \'password\' => \'****\',
                \'port\         


        
相关标签:
3条回答
  • 2020-12-11 10:22

    Its described in the manual of Zendframework

    Zend_Mail::setDefaultTransport($transport);
    

    Then somewhere else instanciate Zend_Mail, write your mail and send it.

    0 讨论(0)
  • 2020-12-11 10:40

    Your example shows an empty link so it wont display anything.

    Unless this is a modified example you used to post on here?

    Does the following display anything when you run it, if not what do you get.

    $smtpHost = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
                    $mail = new Zend_Mail();
                    $mail->setBodyText($form->getValue('body'));
                    $mail->setBodyHtml('<a href = "http://localhost:8080/certificate/certificate-image/id/' . $id . '">my link</a>');
                    $mail->setFrom($certtime['email'], $certtime['first_name'] . $certtime['last_name']);
                    $mail->addTo($form->getValue('reciever'));
                    $mail->setSubject('My Certificate');
                    $mail->send($smtpHost);
    
    0 讨论(0)
  • 2020-12-11 10:44

    See the documentation for full examples (although the Zend docs admittedly often aren't great).

    Based on a comment here:

    $mail = new Zend_Mail();
    $tr = new Zend_Mail_Transport_Smtp(...);
    $mail->setFrom('...', 'Server');
    $mail->addTo($to, '....');
    $mail->setSubject($subject);
    $mail->send();
    Zend_Mail::setDefaultTransport($tr);
    $mail->setBodyText($body);
    
    0 讨论(0)
提交回复
热议问题