How to trace sendmail relay connection?

Hello,

My email server is a FreeBSD 13 server with sendmail, cyrus, mimedefang / spamassasin, etc. It works well and has for a long time. The major downside is that I cannot get a static IP for my connection so I have to use a smarthost relay to send messages to outside recipients. But I recently changed my ISP and now need to use a new relay provider.

I updated the .mc file (I temporarily set the log level to 15), the authinfo file, did a makemap, make all install restart, and sent a test mail to hotmail.

The maillog shows all normal processing until it reaches the relay processing:
Code:
Jul  6 18:00:44 dc-Mail sm-mta[58682]: 566N0hkU058682: --- 250 2.0.0 566N0hkU058682 Message accepted for delivery
Jul  6 18:00:44 dc-Mail sm-mta[58684]: 566N0hkU058682: --- 050 <xxxxxxxx@hotmail.com>... Connecting to pro.turbo-smtp.com. via relay...
Jul  6 18:00:46 dc-Mail sm-mta[58682]: 566N0hkV058682: <-- QUIT
Jul  6 18:00:46 dc-Mail sm-mta[58682]: 566N0hkV058682: --- 221 2.0.0 dc-Mail.example.int closing connection
Jul  6 18:01:59 dc-Mail sm-mta[58684]: 566N0hkU058682: makeconnection (pro.turbo-smtp.com. [169.46.28.199].25 (2)) failed: Operation timed out with pro.turbo-smtp.com.
Jul  6 18:01:59 dc-Mail sm-mta[58684]: 566N0hkU058682: --- 050 <xxxxxx@hotmail.com>... Deferred: Operation timed out with pro.turbo-smtp.com.
Jul  6 18:01:59 dc-Mail sm-mta[58684]: 566N0hkU058682: to=<xxxxxx@hotmail.com>, delay=00:01:16, xdelay=00:01:15, mailer=relay, pri=31088, relay=pro.turbo-smtp.com. [169.46.28.199], dsn=4.4.1, stat=Deferred: Operation timed out with pro.turbo-smtp.com.

Apparently I have an error in connecting to the relay but I don't know how to trace the process. I can successfully send through the relay using a direct telnet connection or Apple mail so I know the username and password work if used properly.

My authinfo file:
Code:
AuthInfo:pro.turbo-smtp.com:587 "U:------------" "P:----------" "M:LOGIN"

Regards,
 
Shot in the dark here:

Looks like the actual error is "Operation timed out with pro.turbo-smtp.com", so if they only accept email only on port 587, that might explain the timeout to 25, in which case you could try switching your config to send on port 587 instead of 25.

Also, your maillog shows attempted connect to pro.turbo-smtp.com port 25, but your authinfo file has credentials for port 587.. The port number might need to match for the proper authinfo credentials to be used.

Answering your original question, I think you have two options to trace it:
  1. Code:
    ktrace -dip sendmaildaemonpid
    (where sendmaildaemonpid is the process-ID of your top-level sendmail daemon). Then after one test email message, ktrace -C to disable all ktraces, then kdump | less to view all system calls for all processes in the sendmail process-tree. (NOTE: kdump is likely to generate megabytes of output, so be prepared :) )
  2. Run tcpdump or wireshark with a capture filter of "port 25 or port 587", then carefully analyze the SMTP command exchange, particularly the SMTP commands and responses regarding any AUTH commands, to make sure it's actually connecting to the remote server, on the right port, getting through the HELO or EHLO, and especially using the credentials you expect.
Option 2 is probably best/easiest, but option 1 might be called-for if option 2 does not help, such as if sendmail decides to use TLS on the TCP connection.
 
At first glance, it looks like your sendmail is trying to connect on port 25:
Code:
makeconnection (pro.turbo-smtp.com. [169.46.28.199].25 (2)) failed: Operation timed out with pro.turbo-smtp.com.

But your authinfo suggests it needs to use port 587:
Code:
AuthInfo:pro.turbo-smtp.com:587 "U:------------" "P:----------" "M:LOGIN"

Although I do use sendmail, I don't use smarthost so no guarantees this will work:
Code:
define(`SMART_HOST', `pro.turbo-smtp.com')dnl  <- you probably have this already
define(`RELAY_MAILER_ARGS',`TCP $h 587')dnl  <- but you might need this
 
Back
Top