[英]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.