Solved

php mail() - not getting bounced messages

Posted on 2010-08-23
15
434 Views
Last Modified: 2013-12-13
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
Comment
Question by:rfiddler
  • 6
  • 4
  • 3
  • +1
15 Comments
 
LVL 17

Accepted Solution

by:
jrm213jrm213 earned 125 total points
ID: 33504851
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
 
LVL 17

Assisted Solution

by:jrm213jrm213
jrm213jrm213 earned 125 total points
ID: 33504865
if you look in the logs on your webserver (if you can) you will probably see what is happening.
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 188 total points
ID: 33504888
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
 

Author Comment

by:rfiddler
ID: 33505307
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
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 187 total points
ID: 33505683
If the messages get categorized as spam, they likely won't get bounced but just deleted these days.
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 188 total points
ID: 33506040
@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
 

Author Comment

by:rfiddler
ID: 33506305
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 187 total points
ID: 33506433
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
 

Author Comment

by:rfiddler
ID: 33506517
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
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 188 total points
ID: 33510837
@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
 

Author Comment

by:rfiddler
ID: 33513853
Thanks!!  I'll check it out.

I'm still testing with the php mail.  I'll post an update on this soon.
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 187 total points
ID: 33514548
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
 

Author Comment

by:rfiddler
ID: 33528405
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
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 33529191
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
 

Author Comment

by:rfiddler
ID: 33534036
Very interesting - thanks Dave!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now