Opencart联系表:在发送的电子邮件的主题或正文中需要发件人电子邮件ID

时间:2017-10-23 07:03:09

标签: php opencart

希望在电子邮件的主题或通过opencart默认联系页面生成的电子邮件正文中包含发件人电子邮件ID。我试过编辑catalog/controller/information/contact.php文件

$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->request->post['email']);

$mail->setSender($this->request->post['name']);

$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name']), ENT_QUOTES, 'UTF-8'));

$mail->setText(strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8')));

$mail->send();

$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name'], $this->request->post['email']), ENT_QUOTES, 'UTF-8'));`   
以上没有帮助。让我知道该尝试或纠正什么。

1 个答案:

答案 0 :(得分:1)

试试这个主题

$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'),$this->request->post['name']).', Email '.$this->request->post['email'], ENT_QUOTES, 'UTF-8')); 

或者这是主题

$mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'),'').'From '.$this->request->post['name'].', Email '.$this->request->post['email'], ENT_QUOTES, 'UTF-8'));

或身体

$mail->setHtml(html_entity_decode('Enquiry: '.$this->request->post['enquiry'].'<br/> From: '.$this->request->post['name'].'<br/> Email: '.$this->request->post['email'], ENT_QUOTES, 'UTF-8'));