In the old days when using “sendmail” if you wanted to watch the SMTP conversation between the local host and the next mail relay all you’d have to do is either run “sendmail -v” or “mail -v” (or “mailx -v” depending on the OS). It would then output the entire SMTP conversation with the remote host, which is useful for diagnosing why a remote host may be refusing your mail.
In more modern implementations “sendmail” actually uses two separate configurations, a “submit.cf” which is used for originating mail, and “sendmail.cf” which is used for delivery/forwarding. Subsequently when you use “sendmail -v” without any additional options it uses “submit.cf” by default, which actually delivers to “localhost” first. Eg:
1 2 3 4 5 6 7 8 9 |
   1% /usr/lib/sendmail –v some.user@somehost.com    TEST    .    EOT    some.user@somehost.com... Connecting to [127.0.0.1] via relay...    220 myhost.com ESMTP MAIL RELAY at your service    >>> EHLO myhost.com    ... |
The solution is to add the “-Am” flag which tells it to bypass the “submit.cf” and use “sendmail.cf” directly:
1 2 3 4 5 6 7 8 9 |
   2% /usr/lib/sendmail –Am –v some.user@somehost.com    TEST    .    EOT    some.user@somehost.com... Connecting to somehost.com via esmtp...    220 somehost.com Hello myhost.com [10.1.1.10], pleased to meet you    >>> EHLO myhost.com    ... |
Note depending on your OS you may have to run “sendmail” with “sudo” to get enough permissions to access the queue entries. You also ideally should provide the “-t” options and put things in like “To:”, “From:”, and “Subject:” to be a good mail citizen, though for testing it isn’t terribly important.
Leave a Reply