2011-11-22 75 views
2

,當我嘗試使用CakeEmail從CakePHP的2.0郵寄我得到這個錯誤:CakePHP的2.0電子郵件的SMTP錯誤

SMTP Error: 502 5.5.1 Unrecognized command. p1si477061pbk.249

我從Gmail發送的,這裏是我的配置:

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', 
); 

主機和端口來自這裏的文章:http://www.google.com/support/a/bin/answer.py?answer=176600

+3

發現問題。 Gmail的非SSL/TLS SMTP服務不支持CakePHP分派的AUTH LOGIN命令。使用SSL/TLS,你應該沒問題。 – Sugitime

回答

0

你必須在你的代碼中使用SSL選項。

/* 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';