OpenCart - 中文论坛
标题:
Opencart Gmail设置邮件发送问题
[打印本页]
作者:
sunboy
时间:
2011-5-31 08:49
标题:
Opencart Gmail设置邮件发送问题
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协议
作者:
acor
时间:
2011-10-30 11:10
1、phpmailer类复制到system/library (class.phpmailer.php,class.smtp.php)
是什么意思 ????
作者:
acor
时间:
2011-11-1 13:58
使用了phpmailer 一样有问题哦。。。
发送还是出错哦
126电邮也是一样
欢迎光临 OpenCart - 中文论坛 (https://bbs.opencart.cn/)
Powered by Discuz! X3.2