[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

php mail() - not getting bounced messages

I'm sending out batches of e-mails using the php mail() function, and I'm not getting any bounced e-mails - even when I've intentionally added incorrect addresses to the list.

I'm using the same script that I used last year when I did this and I was getting bounced e-mails then.  I can't seem to figure out what happened.

Can anybody tell me why this might be?  I'm wondering if they're getting filtered by the ISP somehow.  Is that possible?

Thanks!
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
$headers .= "From: " . $fromName . " <" . $fromEmail . ">\r\n";
$headers .= "Return-Path: " . $fromEmail . "\r\n"; 
$headers .= "Reply-To: " . $fromEmail . "\r\n"; 
$headers .= "X-Mailer: PHP/" . phpversion();


if (mail($to, $subject, $body, $headers)) {
  echo("Message successfully sent to:\t" . $AccessCode . "\t" . $Email . "<br />");
} else {
  echo("Message delivery to " . $AccessCode . "\t" . $Email . " failed.<br />");
}

Open in new window

0
rfiddler
Asked:
rfiddler
  • 6
  • 4
  • 3
  • +1
8 Solutions
 
jrm213jrm213Commented:
I had a similar issue in the past and if i remember correctly the bounced mails get sent back to the webserver that sent them not to the account that it is supposedly sent from, so if your webserver isn't handling your e-mail then the messages are junked. In the situation I had, the account that was sending the e-mails did not have an e-mail account on the server so they were not going anywhere.

0
 
jrm213jrm213Commented:
if you look in the logs on your webserver (if you can) you will probably see what is happening.
0
 
Ray PaseurCommented:
Maybe the receiving server is no longer bouncing automatically generated messages?  I don't bounce anything with anti-spam headers; if it's not routable I just throw it away.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
rfiddlerAuthor Commented:
Thanks for your comments on this.

I've sent tests to multiple different receiving servers, and none of them are bouncing.  I sent e-mails to two of them using my Yahoo account and got bounced messages.

I'll try setting up my e-mail account with my ISP and test with this.

Thanks
0
 
Dave BaldwinFixer of ProblemsCommented:
If the messages get categorized as spam, they likely won't get bounced but just deleted these days.
0
 
Ray PaseurCommented:
@DaveBaldwin:  Exactly my point.  

One of the more interesting nuisance attacks last year was a bozo who sent an "unsubscribe" message to every web site he could find with a return address of a spam cop.  So the web sites politely, but naively send a response email message saying "You are not subscribed" right into the spam honeypot.  And suddenly their legitimate email messages triggered spam filters all over the world.

This is what you get when you let crackpots like Spamhaus handle your email authentication.  Until the governments pass laws to require all email senders and receivers to have SPF authentication, it's just going to be a brittle technology.  We need an equivalent of SSL for email.
0
 
rfiddlerAuthor Commented:
Thanks for all your input.  This seems to be what's happening, although I don't know if they're getting dumped by the receiving mail servers, or if it's my ISP's SMTP server that's doing the deleting of bounced messages.

Do you know of a way I can get around this?
Maybe I can set it up to send a authenticated e-mails using imap_mail?  I'm not sure if this makes sense - I'm fairly new to this.

Thanks
0
 
Dave BaldwinFixer of ProblemsCommented:
The first thing is to make sure you are sending from a valid email address that the receiving sites can look up.  Many sites will dump your email if your sending address can't be verified.

Is this a home server with a private IP address like 192.168.0.2?  If it is your ISP may be blocking your access to port 25 on other servers.  Or many servers consider a private IP address to be a sign of a probably spam source.
0
 
rfiddlerAuthor Commented:
I've tested this from five different valid e-mail addresses, and none of them get bounced messages if I send the e-mail using php.

I'm sending it directly from my site on my ISP's web server.  It's a 199.175._._ address.

I'm thinking of trying it from a different ISP to see what happens.
0
 
Ray PaseurCommented:
@rfiddler:  This is the best question I have seen in a long time at EE: "Do you know of a way I can get around this?"

Yes.  Use Constant Contact to send your email messages.  Look 'em up and get a free trial account.  You'll save yourself countless hours of hateful, non-value-added work spent wrestling with balky and non-standard email programs.
0
 
rfiddlerAuthor Commented:
Thanks!!  I'll check it out.

I'm still testing with the php mail.  I'll post an update on this soon.
0
 
Dave BaldwinFixer of ProblemsCommented:
Yes, checkout @Ray_Paseur's suggestion.  Getting it to send is only the first problem.  Getting it received is at least as big a problem.  Constant Contact and others have done a lot to take care of both those problems.
0
 
rfiddlerAuthor Commented:
Thanks!  You all have been very helpful with this.  I now understand the problem better and I have a way around it.

They were worried about having their mailing list go through a 3rd party web site, and since this mail-out was only to 480 contacts, we ended up just using mail merge in Word and Outlook.  : /  

Constant Contact looks impressive and I'll definitely be using them in the future.
0
 
Dave BaldwinFixer of ProblemsCommented:
So you'll understand even better, Yahoo cuts you off on a Paid email account at 25 emails a day.  My local ISP will cut you off if you have more than 25 CCs in an email.  In many places, you would spends days getting 480 emails out.
0
 
rfiddlerAuthor Commented:
Very interesting - thanks Dave!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 6
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now