555 5.5.2 语法错误。 gmail的smtp
你知道什么是语法错误吗?
这是我使用 cakephp 的代码
$User = $this->User->read(null,$id);
$this->Email->to = array('[email protected]');;
$this->Email->from = '[email protected]';
$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'=>'[email protected]',
'password'=>'********',
);
$this->set('User', $User);
$this->Email->delivery = 'smtp';
$this->Email->send();
注意:我将电子邮件发送给自己用于测试目的。
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('[email protected]');;
$this->Email->from = '[email protected]';
$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'=>'[email protected]',
'password'=>'********',
);
$this->set('User', $User);
$this->Email->delivery = 'smtp';
$this->Email->send();
NOTE: I'm sending the email to myself for test purposes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
这里提出了这个问题:Cakephp SMTP电子邮件语法错误
这是RabidFire的(正确)答案:
This question was asked here: Cakephp SMTP emails syntax error
Here is RabidFire's (correct) answer:
将to和from设置为“[电子邮件受保护] [电子邮件受保护]> ”不适合我。必须将两者更改为“<[电子邮件受保护]>”。将字符串放在 <> 之外部分失败,并显示“邮件发送失败 555 5.5.2 语法错误。.. - gsmtp”
setting to and from as "[email protected] <[email protected]>" was't working for me. Had to change both to "<[email protected]>". Putting a string outside the <> part fails with "Mail send failed 555 5.5.2 Syntax error. .. - gsmtp"
今天刚收到其中一个,我正在使用的一个库在发送邮件之前将站点名称放在方括号中,并导致 555 5.5.2 语法错误。
最好不要在名称所在的地址的第一部分中没有任何符号。我的错误是由以下原因引起
并由以下原因修复的
Just got one of these today, a library I'm using puts the site name in square brackets before sending the mail and causes the 555 5.5.2 Syntax Error.
Your best off having no symbols in the first part of the addres where name should go. My error was caused by
and fixed by
我遇到了这个问题,但使用像 dude.muñ[email protected] 并解决了更改为 dude.mu&#[email protected] (更改unicode 的特殊字符)。
I had this problem with but with an email like dude.muñ[email protected] and solved changing to dude.mu&#[email protected] (Changing the special characters with unicodes).
当“来自”字段为空或无效时,我收到此错误。因此,您不应在测试中使用虚假电子邮件。
I've got this error when "from" field was empty or not valid. So you shouldn't use fake email in your test.
将“你的名字”放在里面<> 发件人字段中的括号。
我正在使用 Erlang、Vagabond/gen_smtp 和 Gmail。
这是我的配置文件的一部分:
和功能:
Put the "YourName" inside <> brackets in sender field.
I'm using Erlang, Vagabond/gen_smtp and Gmail.
This is a part of my config file:
and function:
名称即可解决此问题
我们只需删除替换为的
We solved this issue just by removing the name
Replaced by
其原因是消息格式不正确。可能是来自地址或到地址是错误的(比如一个额外的逗号之类的东西)
Its Due to message format is not correct. may be from address or to address is wrong(like a extra comma something)