我使用的是opencart 1.5.6.4版本,直到现在一切正常。我想在新客户注册时向店主发送警报邮件,因此我启用了警报邮件为“是”。
现在我的问题是当我自定义客户接收的html邮件内容时,商店所有者也收到相同的邮件。请参考以下代码
$subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
$message1 = sprintf($this->language->get('text_welcome'), $this->config->get('config_name')) . "\n\n";
if (!$customer_group_info['approval']) {
$message1 .= $this->language->get('text_login') . "\n";
} else {
$message1 .= $this->language->get('text_approval') . "\n";
}
$message1 .= $this->url->link('account/login', '', 'SSL') . "\n\n";
$message1 .= $this->language->get('text_services') . "\n\n";
$message1 .= $this->language->get('text_thanks') . "\n";
$message1 .= $this->config->get('config_name');
$message1 .='<body>';
$message1 .='<tr>';
$message1 .='<td align="center" valign="top" width="100%" style="background-color: #f7f7f7; height: 100px;">';
$message1 .='<center>';
$message1 .='<table cellspacing="0" cellpadding="0" width="600" class="w320">';
$message1 .='<tr>';
$message1 .='<td style="padding: 25px 0 25px;text-align:center">';
$message1 .='<strong style="text-align:center;">BOOK MY MAGAZINE</strong><br />';
$message1 .='© 2015 Bookmymagazine.com. <br />';
$message1 .='All Rights Reserved<br /><br />';
$message1 .='</td>';
$message1 .='</tr>';
$message1 .='</table>';
$message1 .='</center>';
$message1 .='</td>';
$message1 .='</tr>';
$message1 .='</body>';
$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($data['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->setHtml(html_entity_decode($message1, ENT_QUOTES, 'UTF-8'));
$mail->send();
// Send to main admin email if new account email is enabled
if ($this->config->get('config_account_mail')) {
$message = $this->language->get('text_signup') . "\n\n";
$message .= $this->language->get('text_website') . ' ' . $this->config->get('config_name') . "\n";
$message .= $this->language->get('text_firstname') . ' ' . $data['firstname'] . "\n";
$message .= $this->language->get('text_lastname') . ' ' . $data['lastname'] . "\n";
$message .= $this->language->get('text_customer_group') . ' ' . $customer_group_info['name'] . "\n";
if ($data['company']) {
$message .= $this->language->get('text_company') . ' ' . $data['company'] . "\n";
}
$message .= $this->language->get('text_email') . ' ' . $data['email'] . "\n";
$message .= $this->language->get('text_telephone') . ' ' . $data['telephone'] . "\n";
$mail->setTo($this->config->get('config_email'));
$mail->setSubject($this->language->get('text_new_customer'));
$mail->setText($message);
$mail->send();
// Send to additional alert emails if new account email is enabled
$emails = explode(',', $this->config->get('config_alert_emails'));
foreach ($emails as $email) {
if (strlen($email) > 0 && preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $email)) {
$mail->setTo($email);
$mail->send();
}
}
}
}
答案 0 :(得分:0)
似乎是$ message变量的问题。可能你还没有对它发表评论,不确定。定义管理邮件设计开始的$ message。我建议在$message='';
解决您的问题之后执行以下if ($this->config->get('config_account_mail')) {
。