Help, please, I'm stuck on this one:
Is there any way to extract subdomains out of email addresses?
Say I have a mailing list that includes the member: "joe(_at_)foo(_dot_)com".
If Joe sends a message and his return address this time is:
"Joe Bar" <joe(_at_)sub(_dot_)subdomain(_dot_)foo(_dot_)com>
then his message bounces due to the subdomains in his address. [The
listserve software isn't doing this for me even though it is suppose to,
but that's another problem.]
I can extract Joe's return address from the bounced message using the
following:
:0
* $ ^From $LISTSERVER
* $ !^X-Loop: $LOOP_TEXT
* $ ^Subject: BOUNCE $LIST_NAME: Non-member submission from \[\/[^]]+
{
SENDER="$MATCH"
}
What I need to do is extract all subdomains from $SENDER and then either:
1) resubmit the message as being From: $SENDER to the listserv with the
subdomains removed and see if it bounces again. I'd add a loop header to
check if the message bounces again if $SENDER is really not a member of the
list.
OR
2) grep $SENDER with the subdomains and comments removed against the file
of current members. If found in the file, then forward the message on to
the list using my From address (so the listserv doesn't bounce the message).
Of course, I would have to be able to accept all forms of return addresses
such as:
joe(_at_)subdomain(_dot_)foo(_dot_)com -> joe(_at_)foo(_dot_)com
"Joe Bar" joe(_at_)subdomain(_dot_)foo(_dot_)com -> "Joe Bar"
joe(_at_)foo(_dot_)com
Joe Bar <joe(_at_)subdomain(_dot_)foo(_dot_)com> -> Joe Bar
<joe(_at_)foo(_dot_)com>
Any suggestions?
Bill Moseley
mailto:moseley(_at_)netcom(_dot_)com