Alarm definitions trigger correctly in the vCenter Server inventory, but email notifications are not delivered.
In vCenter Server, /var/log/vmware/messages show Connection timed out with example.com(SMTP Relay server)
YYYY-MM-DDTHH:MM:SS.MS+HH:MM <HOST> ./###### < EMAIL Domain>.: user open1258942]: ########: to=[[email protected]], delay=HH:MM:SS.MS, xdelay=HH:MM:SS.MS, mailer=esmtp, pri=1021763, relay=example.com. [###.##.###.##], dsn=4.4.1, stat=Deferred: Connection timed out with example.comThe SMTP relay server in the logs is not the same as the Email Server configured in vCenter Server -> Configure-> Settings-> General -> Mail -> Mail Server.
vCenter Server 9.0
Sendmail on vCenter Server 9.0 bypasses the configured SMTP relay server and routes emails directly via DNS MX records for the email domain.
Validate that the MX record for the email domain from the DNS server using the following command
dig +short MX <emaildomain>
For eg. dig +short MX example.comTo workaround the issue, manually add the SMTP Relay Server configuration to sendmail using the below steps:
Step 1: Backup and configure sendmail.mc
cp -v /etc/mail/sendmail.mc /root/sendmail.mc.baksudo vi /etc/mail/sendmail.mcLocate the OSTYPE entry in the file. Immediately after the OSTYPE entry, add the following two lines.
FEATURE(nocanonify')dnl
define(SMART_HOST', `[email server]')dnl
For eg.
FEATURE(nocanonify')dnl
define(SMART_HOST', `mail.example.com')dnlSave your changes and close the editor (in vi, type :wq and press Enter).
Step 2: Configure submit.mc
Open the submit.mc file:
sudo vi /etc/mail/submit.mcScroll to the end of the define entries block. Add the following line:
define(confDIRECT_SUBMISSION_MODIFIERS', C')dnlStep 3 Generate New Configuration Files
Change into the mail configuration directory:
cd /etc/mailGenerate the new sendmail.cf file:
sudo m4 m4/cf.m4 sendmail.mc > sendmail.cfGenerate the new submit.cf file:
sudo m4 m4/cf.m4 submit.mc > submit.cfStep 5: Apply Changes and restart Sendmail
Reload the systemd manager configuration:
sudo systemctl daemon-reloadRestart the Sendmail service to apply the new settings:
sudo systemctl restart sendmail