>>>>> "Scott" == Scott Lamb <[EMAIL PROTECTED]> writes:
Scott> My question: How do I find out the SMTP client's IP
Scott> address? I hoped to see this in the envelope stuff, but I
Scott> don't. Nothing else seems to use it. I know Postfix makes
Scott> this information available in the Received: header:
Scott> Received: from helohost (dnslookup [ip.address.literal])
Scott> by thishost (Postfix) with ESMTP id whatever
Scott> but I do not think this is true of all servers.
AFAIK, there isn't a direct way to get the SMTP client's IP address.
The easiest way, as you suggest, would be to parse the Received:
headers. The format of the Received: header does depend on the mail
server, so you'll either have to make the parser configurable or only
support selected mail servers.
Scott> Should I just grab the first "Received" header and see if
Scott> the information I need is present?
At least with cyrus-imapd-2.1.3, it'll be the second header. By the
time the sieve script runs, lmtpd has already added it's Received:
header at the top. It might be a good idea to be able to configure
which Received: header to use -- there may be firewalls or gateways
that insert Received: headers between the outside world and the cyrus
box.
I thought about doing something like this but decided to be lazy and
use SpamAssassin instead, since it does DNSRBL checks...
-- Bob