2
votes

I'm getting this error when I try to mail from CakePHP 2.0 using CakeEmail:

SMTP Error: 502 5.5.1 Unrecognized command. p1si477061pbk.249

I'm sending from Gmail, and here is my config:

public $gmail = array(
    'transport' => 'Smtp',
    'host' => 'aspmx.l.google.com',
    'port' => 25,
    'timeout' => 30,
    'username' => 'user',
    'password' => 'secret',
    'client' => null,
    'log' => true
    //'charset' => 'utf-8',
    //'headerCharset' => 'utf-8',
);

The host and port came from this article here: http://www.google.com/support/a/bin/answer.py?answer=176600

1
Found the problem. Gmail's non-SSL/TLS SMTP service does not support the AUTH LOGIN command that CakePHP dispatches. Use SSL/TLS and you should be ok. - Sugitime

1 Answers

0
votes

You have to use SSL option in your code.

/* SMTP Options */
$this->Email->smtpOptions = array(
'port'=>'465',
'timeout'=>'30',
'host' => 'ssl://smtp.gmail.com',
'username'=>'[email protected]',
'password'=>'your_gmail_password',
);

/* Set delivery method */
$this->Email->delivery = 'smtp';