Unable to receive the mail notification from VC
search cancel

Unable to receive the mail notification from VC

book

Article ID: 441939

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • Users do not receive email alert notifications from the VMware vCenter Server.
  • The issue persists even though SMTP settings appear to be configured correctly within the vCenter Server Management Interface or the vSphere Client.
  • Attempting to send a manual test email via the vCenter Command Line Interface (CLI) fails and returns Name Server timeout and parsing errors:

    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

  • The /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

Cause

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.

Resolution

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.

  1. In the vCenter SMTP configuration settings, wrap the SMTP server address or IP in square brackets (e.g., [smtp.yourdomain.com] or [IP address])
  2. Change the order in which the operating system resolves hostnames by editing the /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-reload
      systemctl restart sendmail
 

      4. 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