我在公司网站上有一个表格,上面有姓名、电话号码和评论(以及其他一些内容)。评论框可让您输入最多 5000 个字符 - 对于非常冗长的客户来说,这是一个很大的限制。有效表单的内容使用 php 表单邮件作为纯文本电子邮件发送到我们的销售部门。
出于某种原因,如果评论超过大约 1000 个字符,它们将带有感叹号、换行符,有时还会插入缩进。注意这仅适用于电子邮件;如果表单中有错误,则将数据插入表单并标记错误,并且注释还没有感叹号+换行符。
我发现一篇关于它的论坛帖子表明存在大约 990 个字符的字符限制会导致此问题。
有人知道原因吗?有谁知道一个相当简单的解决方法?
相关PHP代码:
$to = $email;
$subject = "Website Order Received: $offer";
$contents = "
Order Form Received -\n
Name: $name\n
Company: $company\n
Email: $email\n
Phone: $phone $phoneExt\n
Order Contents:\n" .
($offer == 'web-demo' ? "- I want a live software demonstration.\n" : "") .
($offer == 'pricing' ? "- I'd like pricing information.\n" : "") .
($offer == 'holiday-pricing' ? "- I'd like to sign up before December 31st for the special holiday offer!\n" : "") .
($offer == 'bid-help' ? "- Please give me marketing materials and other assistance for winning bids.\n" : "") .
($offer == 'demo-cd' ? "- Send me the full-version demonstration CD.\n" : "");
if (!empty ($comments)) {
$comments = str_replace("
", "\n", $comments); // Preserves line breaks in the comments.
$contents = $contents."\nComments: $comments\n\n";
}
$contents = str_replace("\n", "\r\n", $contents);
mail($to, $subject, $contents);