Jump to content

mail() Sends Fine...Mailbox Servers Reject It...


mem0ri

Recommended Posts

So I've got a great mail function that works just fine...which I only found out after going through my SMTP server logs and then sending mail to a completely unfiltered e-mail address...

...because it seems that 99% of mailbox providers (Gmail, Yahoo, Hotmail, etc) deny mail coming from my server...

Obviously, that's a big problem.  No, I'm not creating a spam-mailer...more a "forgot password" response mailer...

...is there anything I can put in headers to pass through the filtering?  Or really...any sort of thing I can do to pass through the filtering?
Link to comment
https://forums.phpfreaks.com/topic/25856-mail-sends-finemailbox-servers-reject-it/
Share on other sites

Sure...here is the code:

[code=php:0]

$from = "[email protected]";
$subject = $_POST['subject'];
$body = $_POST['body'];
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From:'.$from."\r\n".'Reply-To:'.$from;
$headers .= 'Date:'.date("r")."\r\n";
$headers .= 'Subject: '.$subject."\r\n";

//...code here to create array of emails to send mail to...

if(isset($subject) && isset($body) && $subject != "" && $body != "")
{
for($x = 0; $x < count($email_list); $x++)
{
mail($email_list[$x], $subject, $body, $headers);

if($x == 0 && count($email_list) > 1) echo("<span class=\"notification\">E-Mail sent to: ".$email_list[$x].", ");
else if($x == 0 && count($email_list) == 1) echo("<span class=\"notification\">E-Mail sent to: ".$email_list[$x]."</span>");
else if($x == (count($email_list) - 1) && $x != 0) echo($email_list[$x]."</span>");
else echo($email_list[$x].", ");
}
}
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.