电子邮件组件 smtp 错误 cakephp
我在使用 cake 的电子邮件组件发送电子邮件时收到此错误
[smtpError] => 535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 r11sm77490vbx.11
有什么想法吗?这是我的代码...
$this->Email->to = array(' juan <[email protected]>');
$this->Email->from = '[email protected]';
$this->Email->subject = 'Welcome to our really cool thing';
$this->Email->template = 'simple_message';
$this->Email->sendAs = 'both';
$this->Email->smtpOptions = array(
'port'=>'465',
'timeout'=>'30',
'auth' => true,
'host' => 'ssl://smtp.gmail.com',
'username'=>'[email protected]',
'password'=>'********',
);
im getting this error when sending emails with cake's email component
[smtpError] => 535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 r11sm77490vbx.11
any ideas? here's my code...
$this->Email->to = array(' juan <[email protected]>');
$this->Email->from = '[email protected]';
$this->Email->subject = 'Welcome to our really cool thing';
$this->Email->template = 'simple_message';
$this->Email->sendAs = 'both';
$this->Email->smtpOptions = array(
'port'=>'465',
'timeout'=>'30',
'auth' => true,
'host' => 'ssl://smtp.gmail.com',
'username'=>'[email protected]',
'password'=>'********',
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的名字前面有一个空格,这可能会发送错误的数据。您是否尝试过没有多余空间的代码?
You have a space there before your name, which could possibly be sending the wrong data. Have you tried the code without that extra space?
好吧,错误消息中指向谷歌支持论坛的链接说用户名和密码组合不正确。我建议您尝试使用指定的密码登录该 Gmail 帐户,以便再次检查您是否有误。这种事经常发生在我身上。
其次,您确定应该将@gmail.com 作为用户名吗?也许它应该只是“名称”而不是“[电子邮件受保护]” 。
Well, the link in the error message to google's support forums say that the username and password combination are incorrect. I'd recommend that you try logging in to that gmail account with the specified password, just to triple check that you're not mistaken. That happens a lot to me, all the time.
Secondly, are you sure you're supposed to put the @gmail.com in for the username? Maybe it should just be 'name' rather than '[email protected]'.
除了@Travis 所说的之外......我还建议发件人也应该以“名称”这种格式构建......否则我认为电子邮件不会通过。
Apart from that stated by @Travis ... i would also suggest that the from should also be constructed in this format "Name " ... otherwise I don't think the email will go through.