Diagnosis case of mail sending failure in Linux SendMail (4): sendmail mail
Recently, I encountered another case where SendMail failed to send an email in Linux. After the email is sent, the email cannot receive the specific email. Check the log/var/log/maillog and find "DSN: user unknown "and" dsn = 5.1.1, stat = User unknown "and other error messages. The specific logs after masking are as follows:
Nov 1 00:45:41 mylnx01 sendmail[17770]: v9VGjfnA017770: Authentication-Warning: mylnx01.xxxx.xxxx.com: oracle set sender to mylnx01-RMAN@xxxxx.com using -f
Nov 1 00:45:41 mylnx01 sendmail[17770]: v9VGjfnA017770: from=mylnx01-RMAN@esquel.com, size=17698, class=0, nrcpts=2, msgid=<201710311645.v9VGjfnA017770@mylnx01.xxxx.xxxx.com>, relay=oracle@localhost
Nov 1 00:45:41 mylnx01 sendmail[17771]: v9VGjfZ2017771: <xxxxxx@esquel.com>... User unknown
Nov 1 00:45:41 mylnx01 sendmail[17771]: v9VGjfZ2017771: <xxxxxx@esquel.com>... User unknown
Nov 1 00:45:41 mylnx01 sendmail[17770]: v9VGjfnA017770: to=zhangl@xxxxxx.com, ctladdr=mylnx01-RMAN@xxxxxx.com (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=77698, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
Nov 1 00:45:41 mylnx01 sendmail[17770]: v9VGjfnA017770: to=eeldba@xxxxxx.com, ctladdr=mylnx01-RMAN@xxxxxx.com (502/502), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=77698, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
Nov 1 00:45:41 mylnx01 sendmail[17771]: v9VGjfZ2017771: from=<mylnx01-RMAN@xxxxxx.com>, size=17698, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Nov 1 00:45:41 mylnx01 sendmail[17770]: v9VGjfnA017770: v9VGjfnB017770: DSN: User unknown
Nov 1 00:45:41 mylnx01 sendmail[17771]: v9VGjfZ4017771: <mylnx01-RMAN@xxxxxx.com>... User unknown
Nov 1 00:45:41 mylnx01 sendmail[17770]: v9VGjfnB017770: to=mylnx01-RMAN@xxxxxx.com, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=48722, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
Nov 1 00:45:41 mylnx01 sendmail[17771]: v9VGjfZ4017771: from=<>, size=18722, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Nov 1 00:45:41 mylnx01 sendmail[17770]: v9VGjfnB017770: v9VGjfnC017770: return to sender: User unknown
Nov 1 00:45:41 mylnx01 sendmail[17771]: v9VGjfZ6017771: from=<>, size=22066, class=0, nrcpts=1, msgid=<201710311645.v9VGjfnC017770@mylnx01.xxx.xxxxxx.com>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Nov 1 00:45:41 mylnx01 sendmail[17770]: v9VGjfnC017770: to=postmaster, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=49746, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v9VGjfZ6017771 Message accepted for delivery)
Nov 1 00:45:41 mylnx01 sendmail[17772]: v9VGjfZ6017771: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=52298, dsn=2.0.0, stat=Sent
This problem occurs because some domain names are set in the configuration file/etc/mail/local-host-names when a sendmail function is tested, this configuration file can be used to support virtual domain names or multiple domain names. Generally, when the host has multiple names and you want to receive emails from multiple host names, you must set this configuration file.
[Root @ mylnx01 log] # more/etc/mail/local-host-names
# Local-host-names-include all aliases for your machine here.
Xxxxx.com
The hostname of this server is different from that specified in local-host-names. This causes an exception in sending emails. After you comment out the host name, SendMail can send emails normally.
[Root @ mylnx01 log] # more/etc/mail/local-host-names
# Local-host-names-include all aliases for your machine here.
# Xxxxx.com
References:
Https://www.linuxquestions.org/questions/linux-newbie-8/sendmail-error-user-unknown-dsn%3D5-1-1-a-4175460428/
Http://linux.vbird.org/linux_server/0380sendmail.php#server_local-host-names