0

这就是我目前向商店的(两个)管理员发送通知的方式

$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');     

$mailText = html_entity_decode($mailText,ENT_QUOTES, 'UTF-8');
/* Email para el admins Alcudia */
$mail->setFrom($this->request->post['email']);
$mail->setSender($this->request->post['name']);
$mail->setTo($admin_alcudia);
$mail->setSubject(html_entity_decode('Se ha realizado una solicitud de reserva', ENT_QUOTES, 'UTF-8'));
$mail->setHtml($mailText);
$mail->send();
/* Email para el admin de palma */
$mail->setFrom($this->request->post['email']);
$mail->setSender($this->request->post['name']);
$mail->setTo($admin_palma);
$mail->setSubject(html_entity_decode('Se ha realizado una solicitud de reserva', ENT_QUOTES, 'UTF-8'));
$mail->setHtml($mailText);
$mail->send();

问题是他们说第二个没有收到它......

知道如何改进吗?有CC功能吗?

我已经等了一整天,但http://docs.opencart.com/不会恢复生机..

4

3 回答 3

7

尝试sendTo()在字符串中用逗号分隔函数:

$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');     

$mailText = html_entity_decode($mailText,ENT_QUOTES, 'UTF-8');

$mail->setFrom($this->request->post['email']);
$mail->setSender($this->request->post['name']);
$mail->setTo($admin_alcudia.','.$admin_palma);
$mail->setSubject(html_entity_decode('Se ha realizado una solicitud de reserva', ENT_QUOTES, 'UTF-8'));
$mail->setHtml($mailText);

$mail->send();

这应该消除重复代码的需要。

于 2013-10-30T16:01:09.713 回答
2

在 OpenCart 2.x 中,您需要将数组传递给setTo()方法。

$mail->setTo(array(0 => 'name@domain.com', 1 => 'name2@domain.com'));
于 2016-01-29T14:48:33.453 回答
0

另一种选择是不必修改任何代码并在设置中更改它,

如果您进入系统,然后进入设置,然后单击商店上的编辑,它将打开您商店的设置...

然后,您需要转到邮件选项卡,然后向下滚动到“附加警报电子邮件”文本框,然后只需添加附加电子邮件地址

无需更改编码...

希望这可以帮助,

于 2013-10-30T20:20:47.413 回答