[Mimedefang] Determine MTA or MSA port: consult the {daemon_*} macros

Jeremy Mates jmates at sial.org
Tue Feb 3 10:49:45 EST 2004


* Steffen Kaiser <skmimedefang at smail.inf.fh-bonn-rhein-sieg.de>
> This sounds cool. Despite the always mentioned problem, when Mail
> clients connect to the server directly - like in my case. Is there a
> way to determine, if the message came in through sendmail's MTA (Port
> 25) or MSA (Port 587) channel?

Sendmail knows what port is being used, and this information is made
available as macros. To see what macros are passed to MIMEDefang, use
the following code from MIMEDefang:

  md_syslog 'info', $QueueID . ': macros: ' .
    join ', ', map { $_.'='.$SendmailMacros{$_} } sort keys %SendmailMacros;

Then send a few test messages, which should reveal the {daemon_name}
macro being passed to MIMEDefang. This macro can be used to translate
back to the port number with a daemon_name to daemon_port hash lookup.
Another option would be to add the {daemon_port} to the list of macros
passed into MIMEDefang, and consult that value directly. For more
information on passing custom Sendmail macros to MIMEDefang, see:

http://sial.org/howto/mimedefang/macro-pass/



More information about the MIMEDefang mailing list