procmail
[Top] [All Lists]

Re: FINDING RELAY IP

2002-07-06 13:50:52
At 15:23 2002-07-06 -0400, Homer Wilson Smith wrote:
   In the following procmailrc is there an easy way for the
perl script called 'spam' to know the IP number of the
mail server sending the e-mail message (relay IP) without
having to scan headers for it?

Oh, oh, I know the answer!

No.

Procmail isn't handed information on the server which passed the message to the MTA (if in fact the message was even passed by a remote server and not locally delivered, or procmail was invoked in generic mail filter mode). The only information you'll have about the connecting server will be in the headers, which you'll have to "scan" (whether your perl script does that, or a procmail MATCH extraction is used, is a different matter - somebody is scanning the headers).

This might work to extract the IP address, but it is untested, and relies on your MTA inserting it into the received in a certain fashion:

:0
* ^Received:.*\[\/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+
{
        HOSTIP=$MATCH
}

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>