Php Mail Bounce

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jandrews3
Forum Newbie
Posts: 2
Joined: Mon Oct 08, 2007 12:01 pm
Location: Cookeville, TN USA

Php Mail Bounce

Post by jandrews3 »

scottayy | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I am using a very simple script for emailing:

Code: Select all

$to = $row['email'];
$subject = "Bounce Test";
$body = "This is a php email bounce test.";
$headers = "From: jandrews@jamesa3.com\r\n" .
"X-Mailer: php".

if (mail($to, $subject, $body, $headers)) echo("<p>Sent.</p>");}
else {echo("<p>Message delivery failed...</p>");}
What I need is when any of the email addresses are not valid, I want it to bounce back to my email address "jandrews@jamesa3.com".
I have looked for examples online, but none of them seem to work. I tried adding:

Code: Select all

"Return-Path: detect-bounce@yourdomain.com\r\n",
&
"Return-Receipt-To: bounce@yourdomain.com\r\n"
... but the ampersand gave an error as did the comma. I then used a period instead of a comma and removed the ampersand ... still no positive results. I tried a variety of different configurations using this code with small changes each time.

This is a very important project for me. I would be very greatful for any help!!! Thank you!


scottayy | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Shouldn't you just be doing..

Code: Select all

$headers .= "Return-Path: detect-bounce@yourdomain.com\r\n";
$headers .= "Return-Receipt-To: bounce@yourdomain.com\r\n"
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
jandrews3
Forum Newbie
Posts: 2
Joined: Mon Oct 08, 2007 12:01 pm
Location: Cookeville, TN USA

Post by jandrews3 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Yeah, I tried that. Unfortunately no help. I thought the following would solve my problems, but it didn't. I'm still at a loss.

Code: Select all

$headers = "From: jandrews@ithf.org\r\nReturn-Path: jandrews@jamesa3.com\r\nReturn-Receipt-To: jandrews@jamesa3.com\r\n";

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply