$config = array('auth' => 'login',
'username' => '****@gmail.com',
'password' => '****',
'port' => '25',
'ssl' => 'tls');
$transport = 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.
在那之后我该怎么办,我可以在哪里放置身体和收件人地址。
3 个解决方案
#1
1
Its described in the manual of Zendframework
它在Zendframework手册中有所描述
Zend_Mail::setDefaultTransport($transport);
Then somewhere else instanciate Zend_Mail
, write your mail and send it.
然后在其他地方实施Zend_Mail,写下你的邮件并发送它。
#2
1
See the documentation for full examples (although the Zend docs admittedly often aren't great).
请参阅文档以获取完整示例(尽管Zend文档通常不是很好)。
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);
#3
1
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);
#1
1
Its described in the manual of Zendframework
它在Zendframework手册中有所描述
Zend_Mail::setDefaultTransport($transport);
Then somewhere else instanciate Zend_Mail
, write your mail and send it.
然后在其他地方实施Zend_Mail,写下你的邮件并发送它。
#2
1
See the documentation for full examples (although the Zend docs admittedly often aren't great).
请参阅文档以获取完整示例(尽管Zend文档通常不是很好)。
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);
#3
1
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);