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
Share on other sites

Sure...here is the code:

[code=php:0]

$from = "admin@mydomain.com";
$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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.