希望在电子邮件的主题或通过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'));`
以上没有帮助。让我知道该尝试或纠正什么。
答案 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'));