我目前正在开发一个网站,帮助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
指的是相同或至少相似的问题。由于它们相当古老,尚未得到答复,我创建了一个新的。希望没有人介意。