我目前正在開發一個網站,幫助codeigniter和ion auth庫。Codeigniter:尋找email-> set_newline(..)功能的解釋
我正在嘗試使用ion auth的標準功能重置用戶密碼。
在庫有2個功能:
forgotten_password($identity)
forgotten_password_complete($code)
這兩個函數(如果驗證經過)發送電子郵件給用戶。功能本身有效,但我收到的電子郵件已損壞。電子郵件標題顯示爲電子郵件正文的一部分。這是一個破碎的電子郵件的外觀:
Date: Fri, 18 Nov 2011 23:36:32 +0100
From: "Example.com" <[email protected]>
Reply-To: "[email protected]" <[email protected]>
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_4ec6ddf0d26b9"
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ALT_4ec6ddf0d26b9
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
New Password for test_user
Your password has been reset to: 0774b65f5e
--B_ALT_4ec6ddf0d26b9
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<html>
<body>
<h1>New Password for test_user</h1>
=09
<p>Your password has been reset to: 0774b65f5e</p>
</body>
</html>
--B_ALT_4ec6ddf0d26b9--
但是我能追查這是造成麻煩線:
$this->ci->email->set_newline("\r\n");
當我註釋掉這一行(在這兩個函數中提到上面),我重置用戶密碼時收到的電子郵件都很好。
有人可以向我解釋這條線的目的嗎?是否僅僅通過評論線來解決這個問題是一個好主意。
我還發現2個問題
- Problem sending email with Codeigniter - Headers sent in the message body
- https://stackoverflow.com/questions/6740672/mime-format-email-breaking-sporadically-in-hotmail-php-codeigniter
指的是相同或至少相似的問題。由於它們相當古老,尚未得到答覆,我創建了一個新的。希望沒有人介意。