Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rational Expression help, please...

Status
Not open for further replies.

admoore

IS-IT--Management
May 17, 2002
224
US
I have PHP checking a POP3 mail account and looping through the text of each email message. I need an expression that will catch the email addresses from the body of the emails to write to a MySQL database. The emails sent to this account are "returns" or failed emails due to bad addresses that need to be purged from the database. As the emails are generated by various mail server daemons, the structure of the failure message varies...

Some samples would be:

Code:
  ----- The following addresses had permanent fatal errors ----- <someuser@aol.com>

or

someuser@ft.blahblah.com    Mailbox unknown or not accepting mail.

or

<user@msn.com>:
207.46.181.13 does not like recipient.
Remote host said: 550 5.2.1 user@msn.com... Mailbox disabled, not accepting 

or

Delivery to the following recipients failed.

       someuser@hotmail.msn.com

TIA for any help here

-Allen
 
You've stumbled onto the problem. Servers do not report errors the same way.

One thing to look at is the path headers. They will be in reverse order of the path the message took, those headers are pretty standard, and the headers include the software the mail server is running.

Parse those, and your script will be able to anticipate the format of the address in the error. Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top