开发者

Sending email via SMTP on zend framework

$config = array('auth' => 'login',
                'username' => '****@gmail.com',
                'password' => '****',
                'port' => '25',
                'ssl' => 'tls');


$trans开发者_StackOverflow社区port = new Zend_Mail_Transport_Smtp('smtp.googlemail.com', $config);

what should i do after that, where can i put the body and the recipient address.


Its described in the manual of Zendframework

Zend_Mail::setDefaultTransport($transport);

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


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);


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜