sendmail[24224]: <VC>: [email protected], size=548, class=0, nrcpts=1, msgid=<##@vcsa65.example.com>, relay=root@localhost
sendmail[24224]: <VC>: [email protected], delay=00:01:05, mailer=esmtp, pri=30548, dsn=4.4.3, stat=queued
sendmail[918]: <VC>: from=<xyz.com>, size=516, class=0, nrcpts=1, msgid=<test.example.com>, relay=root@localhost
sendmail[920]: <VC>: ruleset=check_mail, arg1=<[email protected]>, relay=photon-machine [127.0.0.1], reject=451 4.1.8 Domain of sender address [email protected] does not resolve
sendmail[918]: <VC>: [email protected], [email protected] (0/0), delay=00:01:07, xdelay=00:01:07, mailer=relay, pri=30516, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 451 4.1.8 Domain of sender address [email protected] does not resolve$> echo "Subject: test" | sendmail -v [[email protected]]
example.com: Name server timeout
[email protected]... Transient parse error -- message queued for future delivery
[email protected]... queuedvCenter Server 7.x
vCenter Server 8.x
Note1: Prior to applying resolution ensure you take an offline backup or snapshot of the vCenter Server Appliance.
Note2: The applied configuration change may be lost after upgrade. In such case, Please apply the steps again.
To resolve the issue, force vCenter Server to hand off all email outbound to a designated central mail server (like an internal corporate relay).
1. Connect to vCenter Server Appliance via ssh.
2. Edit sendmail.service using the vi editor.
vi /lib/systemd/system/sendmail.service (This is for 7.0 and later versions)
In earlier releases, the file may be at different directory. (/etc/systemd/system/sendmail.service)
3. Alter the After entry under [Unit] section to be as follows:
/etc/mail/sendmail.mc
6. Add following entry after OSTYPE:
FEATURE(`nocanonify')dnl
define(`SMART_HOST', `[Your_mail_host]')dnl
Note: change Your_mail_host to reflect the correct mail server hostname.
7. Save the change and close the editor.
8. Next, edit submit.mc using the vi editor.
vi /etc/mail/submit.mc
9. Add the following line at the end of the define entries:
define(`confDIRECT_SUBMISSION_MODIFIERS', `C')dnl
10. Save the change and close the editor.
11. Verify that local hostname is present and is resolvable in hosts file.
/etc/hosts
12. Execute following command and generate new .cf file
cd /etc/mail
m4 m4/cf.m4 sendmail.mc > sendmail.cf
m4 m4/cf.m4 submit.mc > submit.cf
13. Reload system daemon and restart sendmail.
systemctl daemon-reload
systemctl restart sendmail
At this point, the vCenter should be able to send emails to the mail server; however, the emails will be sent as root@localhost. Validate it by sending a test alarm and checking the messages log under /var/log/vmware/.
Once validated:
systemctl restart sendmail
Verify In vCenter GUI, Menu -> Inventory -> Configure -> General (under Settings)->Mail->Mail Server.
This action plan would also work in a case where we have VC trying to route the email alerts to localhost instead of SMTP server.
You would see something like following in the messages.log file:YYYY-MM-DDTHH:MM:SS vCENTER-FQDN sendmail[7137]: vc: [email protected] [email protected] (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31012, relay=[127.0.0.1] [127.0.0.1], dsn=4.4.1, stat=Deferred: Connection refused by [127.0.0.1]
YYYY-MM-DDTHH:MM:SS vCENTER-FQDN sendmail[7136]: vc: from=[email protected], size=1012, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
YYYY-MM-DDTHH:MM:SS sendmail[7136]: vc: to=vCENTER-FQDN;, ctladdr=[email protected][email protected] (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31012, relay=[127.0.0.1] [127.0.0.1], dsn=4.4.1, stat=Deferred: Connection refused by [127.0.0.1]