BMaximus has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on a program that parses an incoming email through a pipe from sendmail. It needs to determine who the email was really sent to since its not guaranteed that the To: field is set to the address that the mail was sent to. Most list servers fill the To: field with the list address. So if the recipient isn't in the To,Apparently-To or the X-Apparently-To fields. How am I to determine who the email was really sent to? Barring that the program looks for a specific domain, the one that the email was sent to makes the job easier.
My take on it is as follows but I'm sure there's a better way.
use Mail::Header to parse out the header of the incoming mail. Look in the To: field and see if the domain matches what we're looking for. If its not, then look in the other fields. If they're not then use Email::Find to parse out the Received field from theMail::Header object and go through the email addresses it returns for a valid one.
BMaximus
My take on it is as follows but I'm sure there's a better way.
use Mail::Header to parse out the header of the incoming mail. Look in the To: field and see if the domain matches what we're looking for. If its not, then look in the other fields. If they're not then use Email::Find to parse out the Received field from theMail::Header object and go through the email addresses it returns for a valid one.
BMaximus
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Determining who the email is meant for
by merlyn (Sage) on Nov 25, 2001 at 17:51 UTC | |
by BMaximus (Chaplain) on Nov 26, 2001 at 03:45 UTC | |
by merlyn (Sage) on Nov 26, 2001 at 05:02 UTC | |
Re: Determining who the email is meant for
by mitd (Curate) on Nov 25, 2001 at 14:21 UTC | |
Re: Determining who the email is meant for
by ask (Pilgrim) on Nov 26, 2001 at 07:12 UTC |
Back to
Seekers of Perl Wisdom