555 5.5.2语法错误。 gmail的smtp [英] 555 5.5.2 Syntax error. gmail's smtp

查看:553
本文介绍了555 5.5.2语法错误。 gmail的smtp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我使用cakephp的代码

  $ User = $ this-> User-> read(null,$ id); 
$ this-> Email-> to = array('name@gmail.com');;
$ this-> Email-> from ='name@gmail.com';
$ this-> Email-> subject ='欢迎来到我们真的很酷的事情';
$ 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'=>'********',

);
$ this-> set('User',$ User);
$ this-> Email-> delivery ='smtp';
$ this-> Email-> send();

注意我发送电子邮件给自己测试口袋

解决方案

这个问题在这里被问到: Cakephp SMTP电子邮件语法错误



这是RabidFire的(正确的)答案:


Google的SMTP要求您以以下方式格式化
电子邮件地址:



收件人名称< myname @ example。 com>



从$和
地址执行此操作,您应该很好。
如果您没有
用户的名称,那么您可以重复
电子邮件:



$ this-> Email-> to =
my_test_mail@centrum.cz
< my_test_mail@centrum.cz>;



Do you know what is syntax error refering?

Here's the code I'm using cakephp

 $User = $this->User->read(null,$id);
    $this->Email->to = array('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'=>'********',

   );
    $this->set('User', $User);
    $this->Email->delivery = 'smtp';
    $this->Email->send();

NOTE I'm sending the email to myself for test porpuses

解决方案

This question was asked here: Cakephp SMTP emails syntax error

Here is RabidFire's (correct) answer:

Google's SMTP requires you to format email addresses in the following way:

Recipient Name <myname@example.com>

Do this for both the from and to address, and you should be good to go. If you don't have the name of the user, then you can just repeat the email:

$this->Email->to = "my_test_mail@centrum.cz <my_test_mail@centrum.cz>";

这篇关于555 5.5.2语法错误。 gmail的smtp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆