我正在尝试使用 Gmail SMTP 发送电子邮件。以下是我的代码。
$mail = new Zend_Mail();
$config = array(
'ssl' => 'ssl',
'port' => '465',
'auth' => 'login',
'username' => 'username@gmail.com',
'password' => 'mypassword'
);
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
$sendNow = $mail->setBodyHtml($message)
->setFrom('username@gmail.com', 'abc def')
->addTo($recipient)
->setSubject($subject)
->send($transport);
但是会出现以下错误。怎样才能做到?
Fatal error: Uncaught exception 'Zend_Mail_Protocol_Exception' with message 'Unable to find the socket transport 'ssl' - did you forget to enable it when you configured PHP?' in Implementation\trunk\webapp\library\Zend\Mail\Protocol\Abstract.php:277