magento 实现gmail 发信
一, 修改文件
修改/app/code/core/Mage/Core/Model/Email /Template.php, 找到public function send($email, $name=null, array $variables = array()),删掉此函数中最后几句:
- try {
- $mail->send(); // Zend_Mail warning..
- $this->_mail = null;
- }
- catch (Exception $e) {
- return false;
- }
- return true;
替换为
- $config = array(
- ’ssl’ => ’ssl’,
- ‘port’ => 465,
- ‘auth’ => ‘login’,
- ‘username’ => ‘your_email’,
- ‘password’ => ‘your_password’);
- $transport = new Zend_Mail_Transport_Smtp(’smtp.gmail.com’, $config);
- try {
- $mail->send($transport); //add $transport object as parameter
- $this->_mail = null;
- }
- catch (Exception $e) {
- return false;
- }
- return true;
这样设置下就可以发信了, 如果不可以,试着开启gmail 的pop3, stmp 功能
现在已经有类似这样的插件了, 大家也可以去试下
使用gmail邮箱的插件,key:magento-community/Aschroder_GoogleAppsEmail
cool
下一篇: 子网掩码快速计算方法
