I have a website in which I send a confirmation mail as part of the registration process.
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’?
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.
Also you should use
\r\nas a line terminator instead of just\nFrom PHP.net