procmail
[Top] [All Lists]

Re: Help needed testing antispam tool with procmail

2007-07-17 14:04:38

Hello!

Mar Matthias Darin <BDarin(_at_)tanaya(_dot_)net> wrote:
DynaStop is IP based.  The IP address is usually collected at the
SMTP level.  Is there a way to get the IP address from the Received
from line of the message for passing to an external process or would
this need to be done by the external process? 

You can do this with procmail. I use the following recipe to get the IP
from the sending host:

---
:0
*^Received:.from.*\(\/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\).*by.schatten.darksystem.net
 ..qpsmtpd
* MATCH ?? ^^\/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+
{ SENDERIP = $MATCH }
---

You will have to look in your mails to see how your MTA adds the
Received-headers. Often one can simply use the topmost one. In my case
the MTA accepting the Mails from the outside world isn't the one
running procmail so I had to tweak it a little bit but you should get
the idea. :-)

/Seb

Attachment: signature.asc
Description: PGP signature

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail