Hi i am using codeigniter email library to send mail. It works fine in default config (mailtype=text). But when i change mailtype to 'html' it sends a blank email. Below is my code.
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();
}
Below is the output of 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--
also i have tried with crlf='\\n' and newline='\\n' but no success, I get a blank email. Also tried with charset UTF-8 but no success. The email template is not blank either. It is a complete webpage with a proper body.
Where is your data?
$message=$this->load->view('templates/email/email.php', $your_data, TRUE);
See last paragraph: Returning views as data .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.