VCenter appliance won’t use mail relay server

sendmailvmware-vcenter

tl;dr: – sendmail is configured to use a relay server but still insists on using 127.0.0.1 as the relay, which results in mail not being sent.


We have the open source vCenter appliance (v 5.0) managing our ESXi cluster. When connected to it via vSphere Client, you can configure the SMTP relay server to use by going to Administration > vCenter Server Settings > MAIL. There you can set the SMTP Server value. I looked through their documentation and also confirmed on the phone with support that all you have to do to configure mail is to put in the relay IP or fqdn in that box and hit OK.

Well, I had done that and mail still wasn't sending. So I SSH into the server (which is SuSE) and look at /var/log/mail and it looks like it's trying to relay the email through 127.0.0.1 and it's rejecting it. So looking through the config files, I see there's /etc/sendmail.cf and /etc/mail/submit.cf. You can configure items in /etc/sysconfig/sendmail and run SuSEconfig --module sendmail to generate those to .cf files based on what's in /etc/sysconfig/sendmail.

So playing around, I see that when you set the SMTP Server value in the vCenter gui, all that it does is change the "DS" line in /etc/mail/submit.cf to have DS[myrelayserver.com].

Looking on the internet, it would appear that the DS line is really the only thing you need to change in order to use a relay server. I got on the phone with VMWare support and spent 2 hours trying to modify ANY setting that had anything to do with relays and we couldn't get it to NOT use 127.0.0.1 as the relay. Just to note, any time we made any sort of configuration change, we restarted the sendmail service.

Does anyone know whats going on? Have any ideas on how I can fix this?

Best Answer

On Red Hat systems, there's an /etc/mail/access file for sendmail.

And example of the contents is:

# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
Connect:localhost.localdomain           RELAY
Connect:localhost                       RELAY
Connect:127.0.0.1                       RELAY
172.16.2.116                            RELAY
172.16.2.17                             RELAY

You should define your vCenter's IP in that file (or its SuSE equivalent) and restart the daemon.

Edit:

I assumed you set Sendmail to listen on something other than its loopback address. Go into the sendmail.mc file and look for this stanza.

dnl # The following causes sendmail to only listen on the IPv4 loopback address
dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
dnl # address restriction to accept email from the internet or intranet.
dnl #
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

You want to comment-out the last line there by adding dnl. So you should end up with:

dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

Restart the sendmail service and try again.

Edit:

The OP is trying to configure their Linux-based vSphere appliance to relay through another mail server. This is just a case of defining a SMARTHOST. In your sendmail.mc file, find the line that says:

dnl define(`SMART_HOST', `smtp.your.provider')dnl

Remove the comment line and enter the name of your mail server. If your mail server's name is mail.bootylicious.com, your resulting sendmail.mc line will look like:

define(`SMART_HOST', `mail.bootylicious.com')dnl

Please make sure that you can ping the name you use...

Restart Sendmail.

Related Topic