bounced mail ?

the mail() function

Moderators: macek, egami, gesf

User avatar
relicviper
New php-forum User
New php-forum User
Posts: 21
Joined: Tue Apr 22, 2003 10:02 pm
Location: South Africa, JHB
Contact:

bounced mail ?

Postby relicviper » Thu Jul 15, 2004 4:37 am

Hello guys.

I have a question ..... dont we all :p

but any case. Is there a way i can recieved bounced mail ?
Or is that setup on the server ?

Cheers RV

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Thu Jul 15, 2004 9:32 am

PHP only has built-in facilities to send mail and to read mail from mail (POP3/IMAP) servers, so no, PHP cannot recieve mail, bounced or otherwise.

If you specify correct From: and Reply-to: headers in your e-mail, then you'll be able to recieve bounces through a regular mail server.

Alex
New php-forum User
New php-forum User
Posts: 180
Joined: Fri Mar 07, 2003 4:59 pm
Contact:

Postby Alex » Thu Jul 15, 2004 10:16 am

Listen to what swirlee says, and your life will be a whole lot easier...

User avatar
relicviper
New php-forum User
New php-forum User
Posts: 21
Joined: Tue Apr 22, 2003 10:02 pm
Location: South Africa, JHB
Contact:

Postby relicviper » Fri Jul 16, 2004 12:44 am

Thanx a mill swirlee.

headers is a beautifill thing :)

swirlee i will get swirlee's 101 php bible soon :p

User avatar
relicviper
New php-forum User
New php-forum User
Posts: 21
Joined: Tue Apr 22, 2003 10:02 pm
Location: South Africa, JHB
Contact:

Postby relicviper » Fri Jul 16, 2004 5:05 am

ok i have tried the following.....

what header would i need to add to recieve the bounced mail ?

Code: Select all

 $headers ="MIME-Version: 1.0\r\n";
 $headers.="From: ".$FromName." <".$From.">\n";
 $headers.="To: ".$ToName." <".$To.">\n";
 $headers.="Reply-To: ".$FromName." <".$From.">\n";
 $headers.="X-Priority: 1\n";
 $headers.="X-MSMail-Priority: High\n";
 $headers.="Errors-To: <my@address.co.za>\n";
 $headers.="X-Mailer: My PHP Mailer\n";
got this of php.net manual

what will make this bounch ting work ?
any ideas
Tnx

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Fri Jul 16, 2004 6:07 am

Well, once the correct headers are in place, then the e-mail should be bounced correctly. Then you can retrieved the bounced mail from your mail server exactly as you normally do, e.g. through your e-mail client (Outlook, Thunderbird).

User avatar
relicviper
New php-forum User
New php-forum User
Posts: 21
Joined: Tue Apr 22, 2003 10:02 pm
Location: South Africa, JHB
Contact:

Postby relicviper » Fri Jul 16, 2004 7:43 am

Well, once the correct headers are in place, then the e-mail should be bounced correctly.
Yes i know but i do not have all the diff headers :(

u know of a place where i can have a look at all the diff headers php can use ?

I bet it is somthing very simple but not sure wich one.

I thought it would be Errors-To:

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Fri Jul 16, 2004 8:08 am

So you've tried it and it doesn't work?

Maybe try the Return-Path header.

User avatar
relicviper
New php-forum User
New php-forum User
Posts: 21
Joined: Tue Apr 22, 2003 10:02 pm
Location: South Africa, JHB
Contact:

Postby relicviper » Fri Jul 16, 2004 1:14 pm

thanx will give it a try on monday.

User avatar
relicviper
New php-forum User
New php-forum User
Posts: 21
Joined: Tue Apr 22, 2003 10:02 pm
Location: South Africa, JHB
Contact:

Postby relicviper » Sun Jul 18, 2004 11:13 pm

:( nope still not working ?

Is there maybe a place i can go and see what are all the different sections i can add into the header section ?

Tnx for the help guys.

User avatar
relicviper
New php-forum User
New php-forum User
Posts: 21
Joined: Tue Apr 22, 2003 10:02 pm
Location: South Africa, JHB
Contact:

Postby relicviper » Mon Jul 19, 2004 5:42 am

:-D :grin: :-?

got it sorted

X-From_:

added this to my mail headers.

Thnx for all the help guys :D

Gian_Piero
New php-forum User
New php-forum User
Posts: 22
Joined: Wed Oct 06, 2004 8:12 am
Location: Surfside,Florida
Contact:

Detect bounced mail

Postby Gian_Piero » Mon Oct 18, 2004 9:04 am

Hi Swirlee !
I found this topics who seems to be more or less what I asked you when I created a new topic.
Sorry for repetitions !
Anyway let me say what I am looking for:
1) I send an emai from my php program to (for example) unknown@somebody.com
2) The next time I run my php program I want to check if my MAILER-DAEMON@myserver.com has received a bounced email telling that unknown@somebody.com could not be found.
3) Then in my PHP program I will check if the string "unknown@somedody.com" is contained within the text of the email received by MAILER-DAEMON@myserver.com

That is all, now first my headers:

$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: ".$FromName." <".$From.">\n";
$headers .= "To: ".$ToName." <".$To.">\n";
$headers .= "Reply-To: ".$FromName." <".$From.">\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "Errors-To: <MAILER-DAEMON@myserver.com>\n";
$headers .= "ReturnPath: "MAILER-DAEMON@myserver.com\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "X-Mailer:/usr/lib/sendmail";

mail("unknown@somebody.com", $subject, $message, $headers);

As said above, by the next time I run my PHP, I can test if the string "unknown@somebody.com" is contained within the text of the MAILER-DAEMON.
Now, what is the PHP name of such text string ?

I would really appreciate any help, I know you are super expert !
Regards

Alex
New php-forum User
New php-forum User
Posts: 180
Joined: Fri Mar 07, 2003 4:59 pm
Contact:

Postby Alex » Thu Nov 04, 2004 5:35 am

No idea what you are talking about here, but let me guess, you want to find out whether the string is contained within the message that is received? You can check for it using a regular expression and ereg() or eregi() function... but again if that is not what you are looking for, please explain some more, and ill do my best to get you the info...


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest

cron