必需的邮件标题 [英] Required Mail Headers
问题描述
在注册过程中,我有一个网站发送确认邮件.
I have a website in which I send a confirmation mail as part of the registration process.
前一段时间,由于我不使用标头(PHP邮件功能),所以我发送的邮件有些麻烦.
Some time ago, I had some troubles with the mails I sent since I used no headers (PHP mail function).
一旦放置了一些标头,用户就会收到更多答复,但是我怀疑并非每条消息都到达了目的地.
Once I put some headers, I've gotten more responses from users, but I suspect that not every message reaches its destination.
如何确定邮件到达目的地?
How can I be sure that the messages reach their destination?
哪些标头可以被视为必须"?
Which are the headers that can be considered a 'must'?
这是我的SendMail函数的代码
This is the code of my SendMail function
mail($to,
$subject,
$message,
"MIME-Version: 1.0\n".
"Content-type: text/plain; charset=ISO-8859-1; format=flowder\n".
"Content-Transfer-Encoding: 8bit\n".
"Message-Id: <" . md5(uniqid(microtime())) . "@mysite.com>\n".
"Return-Path: <admin@mysite.com>\n".
"X-Mailer: PHP v".phpversion()."\n".
"From: admin@ mysite.com");
推荐答案
标题的底部需要有一个空格,以将标题与主体分开.诸如垃圾邮件刺客"之类的工具会为此给您很大的帮助.
The headers need a white space at the bottom to separate the header from main body. Tools like Spam Assassin will give you a big mark down for that.
此外,您还应该使用 \ r \ n
作为行终止符,而不仅仅是 \ n
Also you should use \r\n
as a line terminator instead of just \n
多个额外的标头应使用CRLF(\ r \ n)分隔.
Multiple extra headers should be separated with a CRLF (\r\n).
这篇关于必需的邮件标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!