Read IP Address From Received Header

Glenn Steen glenn.steen at
Tue Dec 1 13:29:07 GMT 2009

2009/12/1 Frank Cusack <fcusack at>:
> Last question, I hope!
> For "Read IP Address From Received Header":
> # no or 0  ==> use the SMTP client address, ie. the address of the system
> #              talking to the MailScanner server. This is the normal
> setting.
> # yes or 1 ==> use the first IP address contained in the first "Received:"
> #              header at the top of the email message's headers.
> Since MailScanner is not itself an SMTP server, doesn't the SMTP server
> on the host MailScanner is running on always add a Received: header before
> MailScanner sees the mail?  How would MailScanner ever see the address of
> the SMTP client if it is always [at least] once-removed?
IIRC (always dicey, that assumption:-), there are some situations
where what the MTA stores in its queue files aren't reliably the last
hop, and for those cases this setting will look at the last Received:
header to find that out. For example, it might look like:
Received: from ( [])
        by (Postfix) with ESMTP id 8D80432AF3A
        for <xxxx at>; Tue,  1 Dec 2009 14:11:55 +0100 (CET)
.... In whuch case the "last hop" before our server would be ... Which one can also see in the "non-message" parts of
the queue file, in my case... So I don't need this way of finding that
out. Hence I've got this set to the default.
So the assumption that it wouldn't be visible is false.

> I'm using MailScanner with postfix, using the "hold" queue to pick up
> new mails.  Maybe there's another configuration (content_filter?) or
> for other MTAs there is a way for MS to get the mail before any MTA
> processing?
If you have a setup like Amavisd (or if you've followed my
instructions for how to split multi-recipient mails;-), MailScanner
will always see these as coming from localhost, regardless of method
used. In this case you'd need be able to specify how many Received:
lines to ignore, which (fortunately) is exactly what you can do by
setting a number higher than 1;-).
If you _don't_ have that setting... it indicates that your MailScanner
is rather old... In which case you should immediately move as close as
possible to the latest stable release.

> Since my configuration is
> MX->MS->recipient
So you're not running MS on your MXes? In my case I do, so the "order"
is <sender MTA> -> Postfix-which-lands-in-hold -> MTA ->
Postfix-incoming -> ... mailstore ... So by this I can rely on it to
be right by default.
If you do have another MTA between "the net" and your MS box, then you
really do need set this to 2.

> it seems like I should set this value to 2?  The MX host and the MS host
> both add a Received: header.
Why do you have it like that? BarricadeMX?

> thanks again,
> -frank

-- Glenn
email: glenn < dot > steen < at > gmail < dot > com
work: glenn < dot > steen < at > ap1 < dot > se

More information about the MailScanner mailing list