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 purposes.
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
I've got this error when "from" field was empty or not valid. So you shouldn't use fake email in your test.
I had this problem with but with an email like dude.muñoz@domain.com and solved changing to dude.muñoz@domain.com (Changing the special characters with unicodes).
This question was asked here: Cakephp SMTP emails syntax error
Here is RabidFire's (correct) answer:
setting to and from as "email@email.com <email@email.com>" was't working for me. Had to change both to "<email@email.com>". Putting a string outside the <> part fails with "Mail send failed 555 5.5.2 Syntax error. .. - gsmtp"