【发布时间】:2014-03-03 20:44:07
【问题描述】:
我正在尝试发送电子邮件模板以在注册时进行电子邮件确认。邮件已发送,我可以收到,但我可以在电子邮件中看到 html 代码,而不是按钮和其他元素... 我的Mailer class is shown in jsfiddle,我不知道如何以不同的方式发布它。
我发送电子邮件的功能如下:
public function sendConfirmationMail($user) {
$urlPlugin = $this->getServiceLocator()->get('url_plugin');
$mailer = $this->getServiceLocator()->get('mailer');
$mailer->getMessage()
->addTo($user->getContactEmail())
->setSubject($this->getServiceLocator()->get('translator')->translate('Confirmation'));
$mailer->sendMessage('user/user/mail/confirm',
array(
'user' => $user->getName(),
'confirm_url' => \App\Application::getBaseUrl() . $urlPlugin->fromRoute('user_confirm_rs', array()) . '?code=' . md5($user->getId() . '@' . $user->getConfirmcode()),
'valid_until' => $user->getConfirmationValidUntil()
));
}
【问题讨论】:
-
您是否为电子邮件设置了 MIME 类型?
-
看看这篇好文章:zjhzxhz.com/2014/10/…
标签: php zend-framework2 html-email zend-mail