Php 如何在opencart中向多个收件人发送电子邮件?
这就是我目前向商店的两位管理员发送通知的方式Php 如何在opencart中向多个收件人发送电子邮件?,php,email,opencart,carbon-copy,Php,Email,Opencart,Carbon Copy,这就是我目前向商店的两位管理员发送通知的方式 $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 = 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功能吗
我已经等了一整天,但无法恢复正常运行。尝试用字符串中的逗号分隔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();
这将消除重复代码的需要。另一个选项是不必修改任何代码,也不必在设置中更改代码 如果您先进入系统,然后进入设置,然后单击商店上的编辑,它将打开商店的设置 然后,您需要转到邮件选项卡,然后向下滚动至附加警报电子邮件文本框,然后只需添加附加电子邮件地址 无需更改编码
希望这有帮助,在OpenCart 2.x中,您需要将数组传递给setTo方法
没问题。如果答案对你有帮助,你应该接受它:我猜docs.opencart.com已经关闭,将被替换为…如果你查看一些发送电子邮件通知的opencart的PHP代码,你会发现在opencart中实现这一点是多么容易。然后CTRL+C和CTRL+V是你唯一需要的东西…谢谢-这正是我要找的。我不知道为什么会降价。
$mail->setTo(array(0 => 'name@domain.com', 1 => 'name2@domain.com'));