Technical Resources for Technical People
Header

Enable email on Xenserver using SMTP

July 8th, 2011 | Posted by techblog in Linux | Virtualization

Before we get into a few other articles which will help monitor both your RAID array and S.M.A.R.T disk status under Xenserver, we’ll first need to enable the ability to send emails from our hypervisor. This is going to be done by forwarding email through our actual mail server instead of using Xenserver itself.

Assuming you have a fully functional mailserver setup on either a virtual machine or elsewhere with a valid configuration and mailbox user. (We’ve setup a user on our remote box specific for sending emails on behalf of our hypervisor).

First we need to download the most recent version of the mailx RPM from the CentOS repository and install it.

# wget http://mirror.centos.org/centos-5/5.5/os/i386/CentOS/mailx-8.1.1-44.2.2.i386.rpm
# rpm -hiv mailx-8.1.1-44.2.2.i386.rpm
# nano /etc/ssmtp/ssmtp.conf

Below is a snippet of our config file showing the un-commented lines we added. We’re using a non-standard port 2525.

# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and your mailhub is so named.
#mailhub=mail

mailhub=mail.yourdomain.tld:2525
AuthUser=mailboxusername
AuthPass=m41lB0xp455w0rD

# Where will the mail seem to come from?
rewriteDomain=server1.yourdomain.tld

# The full hostname
#hostname=_HOSTNAME_
hostname=server1.yourdomain.tld

That should technically be all that’s needed. From the commandline you should be able to send email by typing either # mail you@domain.tld or # mailx you@domain.tld to test functionality as it forwards through your SMTP server.

Please remember to open or check the proper ports on your firewall(s). When it comes to our hypervisors we use strict rules for communicating to both the outside world and our internal networks. As a system administrator you should deny everything and explicitly allow traffic on a case by case basis in order to know everything that’s going on inside your network; and which machines have access to various ports.

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

Leave a Reply

Your email address will not be published. Required fields are marked *