nightcode/jmilter

Postfix Relay IP

Closed this issue · 4 comments

Hello,

is it possible to receive the receiver's relay with ip address with Postfix?
The configuration returns only my ip address with {client-addr}.

Thanks!

Hello,
If your Postfix version is ≥ 2.6, you can try to use {rcpt_host} macros at the RCPT stage (http://www.postfix.org/MILTER_README.html#macros).
Hope it is what you are looking for.

Regards, Dmitry

Thank you for your fast answer!

Postfix is version 2.11.4 and milter protocol 6. I used https://github.com/tachtler/jmilter-InfoMilter as example and {rcpt_host} returns the host part of the receiver's mail address.

Example:

Sep 13 16:15:57 server postfix/smtp[32379]: B35CB5ED3D: to=<user@anothercompany.com>, relay=mail.anothercompany.com[123.123.123.163]:25, delay=0.06, delays=0.03/0/0.01/0.02, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 77D0EB6C025)

Actual:

{rcpt_host} returns anothercompany.com

Expected:

mail.anothercompany.com[123.123.123.163]:25 as one or in parts

Additional information:

In the "main.cf" of Postfix, I tried with macros like
milter_rcpt_macros = _ {rcpt_mailer} {rcpt_host} {rcpt_addr} {auth_authen} {client_addr} {mail_host}
(http://www.postfix.org/MILTER_README.html#send-macros).

Because of a milter works during a Postfix before-queue stage, I think the solution in you case may be to get a Postfix QueueID from 'i' macros and grab the relay information from the Postfix log using this QueueID. Not the best solution, but should work.

This could help for the present. As next, I try to search for a better solution without log file.

Thank you for your help and have a nice day!