你知道什么是语法错误引用吗?
这是我正在使用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();
Run Code Online (Sandbox Code Playgroud)
注意:我正在发送电子邮件给我自己进行测试.
Cha*_*aim 23
这里提出了这个问题:Cakephp SMTP电子邮件语法错误
这是RabidFire的(正确的)答案:
Google的SMTP要求您通过以下方式格式化电子邮件地址:
Recipient Name <myname@example.com>这样做既可以来自也可以解决,你应该好好去.如果您没有该用户的名称,那么您可以重复该电子邮件:
$this->Email->to = "my_test_mail@centrum.cz <my_test_mail@centrum.cz>";
设置于与来自称为“email@email.com <email@email.com>” was't为我工作。必须将两者都更改为“<email@email.com>”。将字符串放在 <> 部分之外失败,并显示“邮件发送失败 555 5.5.2 语法错误... - gsmtp”
| 归档时间: |
|
| 查看次数: |
64342 次 |
| 最近记录: |