Hello,
in my website i've a PHP script that automatically mails to my customers a confirmation about the order. My website's domain is registered to a company that hosts my website too. I have a lot of problems to send e-mails using mail() function to some e-mails accounts ... a lot of my users contact me saying that they have never received my automatic e-mail! So this is a very big problem!
The accounts, that give me more problems, are comcast.net, uol.com, mchsi.com and others! I've contacted the support center of these e-mail service providers asking for removing my ip from the block list too.
The header of the e-mail looks like this:
$header = "Sender: $from_mail\n";
$header .= "From: Account <$from_mail>\n";
$header .= "Reply-To: Account <$from_mail >\n";
$header .= "Content-Type: multipart/mixed; boundary=$mixed_boundary\n";
$header .= "Mime-Version: 1.0\n";
$header .= "X-Mailer: PHP/".phpversion()."\n";
$body = "\n--$mixed_boundary\n";
.
.
.
.
$body .= "\n\n--$mixed_boundary--";
mail($to, $subject, $body, utf8_encode($header), "-f$from_mail");
There is something that I can try to avoid this problem? Someone knows where can I look to know what is the IP address of the server used to deliver e-mails thought the PHP mail() function?
Thanks in advance for your replies!!!
Hi,
still today some e-mail provider service such as Comcast, continue to block my IPs addresses saying that my mail server sends spams ... I requested the removing from the blocklist, but their system continue block them! I don't know what else can I do ... I've followed your suggestions and the code look like this:
$md5 = md5(date('r', time()));
$mixed_boundary = "PHP-Mixed-$md5";
$alt_boundary = "PHP-Alt-$md5";
$header = "Sender: $from_mail\r\n";
$header .= "Errors-To: $from_mail\r\n";
$header .= "From: account <$from_mail>\r\n";
$header .= "Reply-To: $from_mail\r\n";
$header .= "Content-Type: multipart/mixed; boundary=$mixed_boundary\r\n";
$header .= "Mime-Version: 1.0\r\n";
$header .= "X-Mailer: PHP/".phpversion()."\r\n";
$body = "\n--$mixed_boundary\n";
$body .= "Content-Type: multipart/alternative; boundary=$alt_boundary\n";
.
.
.
.
$body .= "--$mixed_boundary\n";
$body .= "Content-Disposition: attachment filename=\"...\"\n";
$body .= "Content-Type: application/octet-stream; x-unix-mode=0644; name=\"...\"\n";
$body .= "Content-Transfer-Encoding: base64\n";
.
.
.
.
$body .= "\n\n--$mixed_boundary--";
mail($to, $subject, $body, utf8_encode($header), "-f$from_mail");
Suggestions?
Thanks again!