简体   繁体   English

电子邮件组件smtp错误cakephp

[英]email component smtp error cakephp

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 <name@gmail.com>'); 
 $this->Email->from = 'name@gmail.com';
    $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'=>'name@gmail.com',
        'password'=>'********',

   );

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? 您是否在没有多余空间的情况下尝试了代码?

Well, the link in the error message to google's support forums say that the username and password combination are incorrect. 嗯,错误消息中指向Google支持论坛的链接说用户名和密码组合不正确。 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. 我建议您尝试使用指定的密码登录该gmail帐户,以确保您没有误认三次。 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? 其次,确定要为用户名添加@ gmail.com吗? Maybe it should just be 'name' rather than 'name@gmail.com'. 也许应该只是“名称”而不是“ name@gmail.com”。

除了@Travis所说的...之外,我还建议from也应该以“名称”格式构建...否则,我认为电子邮件不会通过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM