我已经成功地使用CakePHP的电子邮件组件来发送我的电子邮件,但由于限制,我现在需要设置它使用smtp中继服务器,我收到了一些奇怪的结果。CakePHP电子邮件组件smtp失败
这里是我的代码:
$this->Email->to = $user['User']['username'].' <'.$user['User']['email'].'>';
$this->Email->subject = 'MyWebsite.com – Please confirm your email address';
$this->Email->from = 'MyWebsite.com <[email protected]>';
$this->Email->template = 'user_confirm';
$this->Email->sendAs = 'html';
$this->Email->smtpOptions = array(
'timeout' => '30',
'port' => '25',
'host' => 'mail.myrelayserver.com',
'username' => 'USERNAME',
'password' => 'PASSWORD'
);
$this->Email->delivery = 'smtp';
if ($this->Email->send()) {
return true;
} else {
echo $this->Email->smtpError;
}
现在,每当我尝试发送该邮件,发送失败,我从$以下输出中这个 - >的电子邮件 - > smtpError:
14.2/Kp; Sun, 14 Feb 2010 19:11:07 GMT
有什么建议吗?
我刚刚成功地通过telnet连接,并得到了充分的sendmail问候这个时间,所以看起来你是对的 – gomezuk