【发布时间】:2014-11-18 12:04:31
【问题描述】:
<?php
$subject = $this->language->get('text_subject');
$message = "este es el mensaje";
$html = "<html><head><title>Documento sin título</title></head><table>
<tr>
<td>Ticket</td>
<td>Status</td>
<td>action</td>
<td>account type</td>
</tr>
<tr>
<td>1</td>
<td>COMPLETED</td>
<td>CREATE</td>
<td>DEMO</td>
</tr>
</table><body></body></html>"
$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($customer_query->row['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);
$mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
$mail->send();?>
我有这个代码发送电子邮件php,$html包含代码html发送邮件,但只出现html代码而没有出现文本。代码有错误?
【问题讨论】:
-
您使用哪个类来发送电子邮件。必须有一些选项来设置要发送的 HTMLemail。我希望在你的脚本中某个地方定义了 $html
-
我已经修改了代码
-
正文设置为 $message,即“este es el mensaje”——这就是您要发送的内容吗?
-
是的,这就是我要发送的内容
标签: php html email opencart send