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

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

问题描述

你知道什么是语法错误吗?

Do you know what is syntax error refering?

这是我正在使用 cakephp 的代码

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 purposes.

推荐答案

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

This question was asked here: Cakephp SMTP emails syntax error

这是 RabidFire 的(正确)答案:

Here is RabidFire's (correct) answer:

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

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

收件人姓名 <myname@example.com>

对 from 和 to 都执行此操作地址,你应该很高兴去.如果你没有名字用户,那么你可以重复电子邮件:

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天全站免登陆