root@vcenterfqdn [ ~ ]# echo "Subject:vCenter Alerts Notification"|sendmail -v email address
email.com: Name server timeout
email.com... Transient parse error -- message queued for future delivery
email.com... queued
/var/log/messages.log file actively records emails getting stuck in the queue: yyyy-mm-dd [HOSTNAME] sendmail[#######]: [QUEUE_ID]: from=[SENDER_EMAIL], size=1115, class=0, nrcpts=2, msgid=<[MESSAGE_ID]>, relay=[RELAY_ID]
yyyy-mm-dd [HOSTNAME] sendmail[#######]: [QUEUE_ID]: to=[RECIPIENT_EMAIL_1], delay=00:01:33, mailer=esmtp, pri=61115, dsn=4.4.3, stat=queued
yyyy-mm-dd [HOSTNAME] sendmail[#######]: [QUEUE_ID]: to=[RECIPIENT_EMAIL_2], delay=00:01:33, mailer=esmtp, pri=61115, dsn=4.4.3, stat=queued
This issue occurs due to a DNS resolution failure within the vCenter Server Appliance. When vCenter generates an email alert, its internal Mail Transfer Agent (sendmail) queries DNS to resolve the destination email address. If the DNS servers configured on the vCenter appliance lack the proper records or return a SERVER FAIL status, the email gets stuck in the queue.
To resolve this issue, bypass the standard Mail Exchanger record lookup and adjust the local host resolution priority so the vCenter appliance routes the emails directly to the SMTP relay.
Ensure to take an offline snapshot or file-based backup of your vCenter Server before making changes to configuration files.
/etc/nsswitch.conf file. a. SSH into the vCenter appliance as root
b. Open /etc/nsswitch.conf file using the below command
vi /etc/nsswitch.conf c. Locate the hosts: line and move the resolve parameter to the end of the list. This is required because the nameserver is always returning `SERVER FAIL` for the lookups.
Before: #Begin /etc/nsswitch.conf passwd: files ato group: files shadow: files hosts: files resolve dns networks: files protocols: files services: files ethers: files rpc: files #End /etc/nsswitch.conf
After:
#Begin /etc/nsswitch.conf passwd: files ato group: files shadow: files hosts: files dns resolve networks: files protocols: files services: files ethers: files rpc: files #End /etc/nsswitch.conf
3. Reload Daemons and Restart Sendmail using the below commands:
systemctl daemon-reloadsystemctl restart sendmail4. Flush the DNS Cache using the below command
kill -USR1 $(pgrep dnsmasq)
Trigger a manual test email from the CLI using the below command, or generate an alert within vCenter to confirm that the mail successfully routes to your inbox.
echo "Subject:vCenter Alerts Notification"|sendmail -v email address