电子邮件组件smtp错误cakephp

时间:2010-11-29 08:39:38

标签: email cakephp components smtp

在发送带有cake的电子邮件组件的电子邮件时出现此错误

[smtpError] => 535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 r11sm77490vbx.11

任何想法?这是我的代码......

 $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'=>'********',

   );

3 个答案:

答案 0 :(得分:1)

你的名字前面有一个空格,这可能是发送错误的数据。您是否尝试过没有额外空间的代码?

答案 1 :(得分:1)

嗯,谷歌支持论坛的错误消息中的链接表示用户名和密码组合不正确。我建议您尝试使用指定的密码登录该Gmail帐户,只需三重检查您没有弄错。这种情况一直发生在我身上。

其次,你确定你应该把@ gmail.com用于用户名吗?也许它应该只是'name'而不是'name@gmail.com'。

答案 2 :(得分:1)

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