想要知道是否有任何函数/类/等...来帮助我的HTML因此而影响电子邮件的990字符限制.
问题:( 来源)
请注意,邮件服务器对电子邮件中包含的每一行都有990个字符的限制.如果发送的电子邮件包含长度超过990个字符的行,则这些行将被其他行结束字符细分,这可能会导致电子邮件中的损坏,特别是对于HTML内容.要防止这种情况发生,请在电子邮件中的适当位置添加自己的行结束字符,以确保没有行超过990个字符.
其他人似乎都有这个问题?你是怎么解决这个问题的?
听起来我需要找到一个分割HTML并手动添加换行符的好地方,呃......
更新:
它是包含许多行的指法数据.所以我需要添加一个\n或<br />某个地方?
更新#2:添加MIME类型代码
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: quoted-printable\r\n"; // added this, but still no results
$headers .= "From: from@email.com\r\n";
Run Code Online (Sandbox Code Playgroud)
这是我如何调用函数:
我原来怎么称呼:
return $html;
Run Code Online (Sandbox Code Playgroud)
我尝试了什么:
return imap_8bit($html); // not working, nothing is captured in the error log
Run Code Online (Sandbox Code Playgroud)
和
return imap_binary($html); // not working, nothing is captured in the error log
Run Code Online (Sandbox Code Playgroud)
更新#3(添加邮件功能)
try {
mail(
'to@email.com',
'Subject of Email',
$html,
$headers
);
} catch …Run Code Online (Sandbox Code Playgroud)