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.
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 <[email protected]>
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 = "[email protected] <[email protected]>";
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With