[英]Codeigniter Email library gives error when sending html mail
嗨,我正在使用codeigniter电子邮件库发送邮件。 在默认配置(mailtype = text)中,它可以正常工作。 但是,当我将邮件类型更改为“ html”时,它将发送空白电子邮件。 下面是我的代码。
public function sendmail($mail){
$config = Array(
'useragent' => 'SPTechbook.com',
'mailtype' => 'html',
'crlf' => '\r\n',
'newline' => '\r\n',
'charset' => 'iso-8859-1'
);
$this->load->library('email',$config);
$this->email->from('donot-reply@sptechbook.com', 'SPTechbook');
$this->email->to($mail);
$this->email->subject('Email Verification');
$message=$this->load->view('templates/email/email.php',TRUE);
$this->email->message($message);
$this->email->send();
echo $this->email->print_debugger();
}
以下是print_debugger()的输出
Your message has been successfully sent using the following protocol: mail
User-Agent: SPTechbook.com
Date: Sun, 3 Aug 2014 06:21:14 +0000
From: "SPTechbook" <donot-reply@sptechbook.com>
Return-Path: <donot-reply@sptechbook.com>
Reply-To: "donot-reply@sptechbook.com" <donot-reply@sptechbook.com>
X-Sender: donot-reply@sptechbook.com
X-Mailer: SPTechbook.com
X-Priority: 3 (Normal)
Message-ID: <53ddd4daa9a57@sptechbook.com>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_53ddd4daa9aa1"
=?iso-8859-1?Q?Email_Verification?=
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ALT_53ddd4daa9aa1
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
--B_ALT_53ddd4daa9aa1
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
--B_ALT_53ddd4daa9aa1--
我也尝试了crlf ='\\ n'和newline ='\\ n',但是没有成功,我收到了一封空白电子邮件。 也尝试使用字符集UTF-8,但没有成功。 电子邮件模板也不是空白。 这是一个具有适当正文的完整网页。
您的数据在哪里?
$message=$this->load->view('templates/email/email.php', $your_data, TRUE);
请参阅最后一段: 将视图作为数据返回 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.