如果内容超过某些限制,则PHP电子邮件中断 [英] PHP email interrupted if content exceeds certain limit

查看:133
本文介绍了如果内容超过某些限制,则PHP电子邮件中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PHP mail()发送每日通知电子邮件。

I am using PHP mail() to send daily notice emails.

但是我注意到,如果存储邮件内容的字符串太长,电子邮件将被中断,即仅显示部分内容在收到的电子邮件中。

But I noticed that if the string, which stores the content of the mail, is too long, the email will be interrupted, i.e. only parts of the content will be displayed in the received emails.

当内容字符串短,电子邮件将完成。所以似乎PHP对于字符串的长度有一些限制。

When content string is short, the email will be complete. So it seems that PHP has some kinds of limits for the length of string.

我试图使用 echo $ content; 显示存储内容的字符串,内容在浏览器中完成。但是当电子邮件中发出相同的字符串时,它就会中断。

I tried to use echo $content; to display the string that stores the content, the content is complete in the browser. But when the same string sent out in the email, it becomes interrupted.

有人可以帮我吗?感谢提前!

Can anyone help me out with this? Thanks in advance!

推荐答案

尝试使用以下脚本:

mail($to, $subject, chunk_split(base64_encode($message), "Content-Transfer-Encoding: base64\r\n");

说明:


  • 电子邮件标准RFC2822每行只接受998个长度的字符。

  • 电子邮件客户端可以更好地读取base64编码的字符串。

干杯!

这篇关于如果内容超过某些限制,则PHP电子邮件中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆