[kwlug-disc] how to recognize incoming emails that are "delivery failed" msgs?

Robert P. J. Day rpjday at crashcourse.ca
Thu May 6 13:01:54 EDT 2010


   (and now, for something totally geeky ...)

   more email-related crunchy goodness -- i have /etc/valiases set up  
on a system that shunts all incoming emails to a (PHP) script and,  
before i do any serious processing on an email, i want to quickly  
reject any emails that are nothing more than "delivery failed"  
messages.  don't care about them, want to toss them out entirely.  so  
how quickly can i recognize them?

   as it is, there are various strings that give it away, like,  
"Delivery Status Notification" in the subject line, or "Mail System  
Error" in that line, or having it coming from an address that contains  
"MAILER-DAEMON", or having the body of the message contain the line,  
"This message was created automatically by mail delivery software".   
all very explicit.  all very painful.

   is there any email standard that covers what a mail delivery error  
has to look like?  at the very least, will it be a single-part message  
whose content-type is "text/plain"?  if that's true, i can at least  
recognize immediately that any message not of that type doesn't  
represent a delivery error message and jump to processing the contents.

   any shortcuts?  thanks.

rday






More information about the kwlug-disc mailing list