Educational ICT Virtualisation Specialist

Twitter LinkedIn E-mail
Precedence Technologies Ltd
Technology House, 36a Union Lane
Cambridge, CB4 1QB, United Kingdom
T: +44 (0)8456 446 800 / +44 (0)1223 359900
E: enquiries@precedence.co.uk
XenServer-Email

Jump To: Support > KB > Citrix > XenServer > Email

Configuring and testing email alerts

Local SMTP server that accepts unauthenticated emails

If you have a local SMTP server that accepts unauthenticated emails (possibly from an unqualified domain e.g. noreply@myservername), then you can do this from within XenCenter:

  1. Right-click on your pool and choose Properties
  2. On your pool properties, select the Email Options section on the left:
  3. Tick the Send email alter notifications and enter the email address to send to and the SMTP server details

Testing

  1. Log in as root onto your pool master (either console or over ssh)
  2. Determine your pool's UUID:
    [root@xen ~]# xe pool-list --minimal
    7b77a9ef-dd01-fb77-08d9-52a76e0bdb09
    
  3. Create an event entry with a high enough priority to trigger an email (2 is good):
    [root@xen ~]# xe message-create pool-uuid=7b77a9ef-dd01-fb77-08d9-52a76e0bdb09 name="Test" body="Test message" priority=2
    
  4. The event will be shown in XenCenter:
  5. You should receive an email similar to:
    From: noreply@xen.internal
    To: support@mydomain.com
    Subject: [MyPool] XenServer Message: Pool 7b77a9ef-dd01-fb77-08d9-52a76e0bdb09 Test
    
    Field		Value
    -----		-----
    Name:		Test
    Priority:	2
    Class:		Pool
    Object UUID:	7b77a9ef-dd01-fb77-08d9-52a76e0bdb09
    Timestamp:	20220225T09:43:26Z
    Message UUID:	9501d44b-fb9d-4ce9-901d-3590e0460b0d
    Pool name:	MyPool
    Body:	Test message
    
  6. If you do not receive the mail, check /var/log/maillog on the hypervisor you are logged onto

Advanced settings (overriding sending address, STARTTLS, SMTP authentication)

If your mail server rejects the emails because they have an invalid sender email address or you need to send via a server that requires authentication, you will need to do further manual configuration.

To alter the sending address, create /etc/mail-alarm.conf using the nano editor. Enter the email address in the root= line, the domain in the RewriteDomain= line and the SMTP server in the mailhub= line:
root=support@mydomain.com
mailhub=192.168.30.40:25
RewriteDomain=mydomain.com
After sending a test, you will see the sender has now changed to:
From: "root" <root@mydomain.com>
For authenticated SMTP, you will need to determine whether you want to send with TLS (usually port 465) or STARTTLS (ports 25 or 587). Edit /etc/mail-alarm.conf. For STARTTLS use something like:
authUser=smtpuser
authPass=smtppass
mailhub=smtp.myisp.com:587
UseSTARTTLS=yes
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt
For TLS (e.g. for Gmail) use:
authUser=smtpuser
authPass=smtppass
mailhub=smtp.myisp.com:465
UseTLS=yes
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt
You can combine this with the root= and RewriteDomain= lines as required. You must include the TLS_CA_File= line otherwise you wlil get errors like:
Feb 25 08:37:15 xen sSMTP[17841]: Creating SSL connection to host
Feb 25 08:37:15 xen sSMTP[17841]: SSL not working: certificate verify failed (20)
Feb 25 08:37:15 xen sSMTP[17841]: Cannot open 192.168.30.40:25

You should put the /etc/mail-alarm.conf file on each member of your pool.

© Copyright Precedence Technologies 1999-2024
Page last modified on February 25, 2022, at 10:15 AM by sborrill