通过Zend_Mail的SMTP传送器方式发送Gmail邮件

关键配置:

1:php   php.ini中   extension=php_openssl.dll ,把;去掉

2:apache httpd.conf  LoadModule ssl_module modules/mod_ssl.so 把#去掉




require_once 'Zend/Mail.php';
require_once 'Zend/Mail/Transport/Smtp.php';

$mail = new Zend_Mail();
$config = array('auth' => 'login',
    'username' => '登陆的邮箱',
    'password' => '密码',
    'ssl' => 'ssl',
    'port' => 465
);
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
$mail = new Zend_Mail();
$mail->setBodyText('发送的邮件内容');
$mail->setFrom('[email protected]', 'XXXXXXr');
$mail->addTo('[email protected]', 'XXXXXX');
$mail->setSubject('邮件主题');
$mail->send($transport);


你可能感兴趣的:(apache,PHP,Gmail,Zend)