Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

php mail() - not getting bounced messages

Posted on 2010-08-23
15
Medium Priority
?
445 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 3
  • +1
15 Comments
 
LVL 17

Accepted Solution

by:
jrm213jrm213 earned 500 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 500 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 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 752 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 84

Assisted Solution

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

Assisted Solution

by:Ray Paseur
Ray Paseur earned 752 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
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 748 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 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 752 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 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 748 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 84

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Check out the latest tech news, community articles, and expert highlights in August's newsletter.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

618 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