可參考檔案根目錄的 /catalog/model/checkout/order.php
它每次使用寄信功能,都是使用下面這一段:
$mail = $this->factory->newMail();
$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($order_info['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($order_info['store_name']);
$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
$mail->setHtml($html);
$mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
$mail->send();
protocol, username, password 這些內容都已經預先設定好, 所以 $mail->timeout 以上那幾行,似乎應該不用每次都呼叫。但 opencart 就是每次都重寫。opencart 好多重複的程式碼~
沒有留言:
張貼留言