搜索
开启辅助访问 切换到宽版

QQ登录

只需一步,快速开始

扫一扫,访问微社区

注册 找回密码
查看: 8029|回复: 2
打印 上一主题 下一主题

Opencart Gmail设置邮件发送问题

[复制链接]
跳转到指定楼层
楼主
发表于 2011-5-31 08:49:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Opencart自带类不能发送Gmail(https不能发送),我把mail.php类修改成phpmailer类,此问题解决,解决方式如下
1、phpmailer类复制到system/library  (class.phpmailer.php,class.smtp.php)
2、修改opencart初始文件system/startup.php。在startup.php尾部加一行require_once(DIR_SYSTEM . 'library/class.phpmailer.php')并注释require_once(DIR_SYSTEM . 'library/mail.php')
3、修改catalog\controller\information\contact.php
   
   $mail = new Mail();
   $mail->protocol = $this->config->get('config_mail_protocol');
   $mail->parameter = $this->config->get('config_mail_parameter');
   $mail->hostname = $this->config->get('config_smtp_host');
   $mail->username = $this->config->get('config_smtp_username');
   $mail->password = $this->config->get('config_smtp_password');
   $mail->port = $this->config->get('config_smtp_port');
   $mail->timeout = $this->config->get('config_smtp_timeout');   
   $mail->setTo($this->config->get('config_email'));
     $mail->setFrom($this->request->post['email']);
     $mail->setSender($this->request->post['name']);
     $mail->setSubject(sprintf($this->language->get('email_subject'), $this->request->post['name']));
     $mail->setText(strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8')));
         $mail->send();
修改成
   $mail = new PHPMailer();
   $mail->IsSMTP();     
   $mail->IsHTML(true);  
   $mail->CharSet = "utf-8";
   $mail->Encoding = "base64";
   $mail->Host = $this->config->get('config_smtp_host');//smtp主机
   $mail->SMTPAuth = true;
   $mail->Username = $this->config->get('config_smtp_username');//帐号
   $mail->Password = $this->config->get('config_smtp_password');//密码
   $mail->Port = $this->config->get('config_smtp_port');//端口
   $mail->From = $this->config->get('config_email');//发件邮箱
   $mail->FromName = "*****";//发件人名字
   $mail->AddAddress($this->request->post['email'], $this->request->post['name']);  //收件地址
   $mail->WordWrap = 50;
   $mail->Subject = sprintf("***** ".$this->request->post['name']); //主题
   $mail->Body    = strip_tags($this->request->post['enquiry']); //内容
   $mail->Send();
4、以上只是修改contact us邮件功能,其它地方邮件发功能都要(包括注册,订单等)修改,参照contact.php。如果不知道在那里修改,用Dreamweaver搜索“new Mail()”
注:后台设置
(Gmail)smtp host:ssl://smtp.gmail.com
(Gmail)smtp port:465


另外问清楚主机是否支持 SSL协议
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 分享分享 支持支持 反对反对
回复

使用道具 举报

沙发
发表于 2011-10-30 11:10:49 | 只看该作者
1、phpmailer类复制到system/library  (class.phpmailer.php,class.smtp.php)

是什么意思 ????
回复 支持 反对

使用道具 举报

板凳
发表于 2011-11-1 13:58:46 | 只看该作者
使用了phpmailer  一样有问题哦。。。

发送还是出错哦

126电邮也是一样
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

QQ|手机版|OpenCart - 中文官方网站 ( 蜀ICP备09033774号|人工智能

GMT+8, 2024-5-4 15:28 , Processed in 0.058959 second(s), 24 queries , Gzip On.

快速回复 返回顶部 返回列表