TShopping
標題:
opencart 如何引入mail function 發信
[打印本頁]
作者:
woff
時間:
2015-8-1 00:21
標題:
opencart 如何引入mail function 發信
小弟最近在改模組
有需要使用到OPENCART的MAIL發信
於是研究了一下
要讓廠商上架商品後發信給管理員
那我們看看怎麼做
後台找到 admin\model\catalog\product.php
在function addProduct最後
大括弧上 "}"
加入
//add by woff
$this->language->load('mail/customer');
$subject = $this->config->get('config_name')." 有廠商商品上架嚕";
$message = $this->config->get('config_name')." 親愛的管理員你好\n\n";
$message .= "有廠商商品上架嚕 \n\n";
$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->config->get('config_email'));
$mail->setSender($this->config->get('config_name'));
$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
$mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
$mail->send();
//add by woff
複製代碼
這樣就可以了
完程如下圖
addproduct.png
(68.9 KB, 下載次數: 10)
下載附件
保存到相冊
2015-8-1 00:20 上傳
作者:
蓦然回首
時間:
2016-3-13 13:25
行,有意义,我顶 谢谢您了
歡迎光臨 TShopping (http://www.tshopping.com.tw/)
Powered by Discuz! X3.2