This article describes how to configure XenServer to send system alerts through SMTP servers that require authentication.
Administrative access to a XenServer host console either directly, through SSH, or by using the Console tab in XenCenter.
Customers can configure XenServer to send email notifications when system alerts are generated by XenServer hosts. This can be done either by using XenCenter, or by using the xe Command Line Interface (CLI). For instructions on how to enable email notifications, see the section Enabling email notifications.
When using XenCenter or the xe CLI to enable email notifications, customers should enter the details of an SMTP server, which does not require authentication. Emails sent through SMTP servers which require authentication will not be delivered.
However, customers who wish to send emails through authenticated SMTP servers can do so by creating a configuration file, mail-alarm.conf in the /etc/ folder. For instructions on how to create the mail-alarm.conf file, see the section, Configuring XenServer to send emails alerts through authenticated SMTP servers.
Note: Enter the details of an SMTP server which does not require authentication.
Right-click a host or pool in the Resources pane and select Properties.
In the Properties window, select Email Options.
Select the Send email alert notifications check box and enter the email address and the SMTP server.
Log on as root (either through the console in XenCenter or by SSH access).
Run the following command:
xe pool-param-set uuid=<uuid> other-config:mail-destination=<joe.bloggs@domain.tld>
xe pool-param-set uuid=<uuid> other-config:ssmtp-mailhub=<smtp.domain.tld[:port]>
The mail-alarm utility in XenServer uses sSMTP to send email notifications. Before sending email notifications, the mail-alarm utility looks for the configuration file, mail-alarm.conf. If the configuration file exists, the contents of the file will be used to configure sSMTP, otherwise the details avaiable in the XAPI database (as configured using XenCenter or the xe CLI) will be used to send email alerts.
To send email notifications through authenticated SMTP servers, customers should create a mail-alarm.conf file in /etc/ with the following contents:
root=postmaster authUser=<username> authPass=<password> mailhub=<server address>:<port>
Note: This configuration file will be used for all system alerts generated by XenServer hosts. Customers should note that Virtual Machine Protection Policy (VMPP) alerts require a per-policy configuration and thereby cannot use themail-alarm.conf file to send VMPP alerts.
Each SMTP server can differ slightly in its setup and may require additional configuration. Refer to the following extract from the ssmtp.conf man page for the correct syntax and available options:
NAME ssmtp.conf – ssmtp configuration file DESCRIPTION ssmtp reads configuration data from /etc/ssmtp/ssmtp.conf The file con- tains keyword-argument pairs, one per line. Lines starting with '#' and empty lines are interpreted as comments. The possible keywords and their meanings are as follows (both are case- insensitive): Root The user that gets all mail for userids less than 1000. If blank, address rewriting is disabled. Mailhub The host to send mail to, in the form host | IP_addr port [: port]. The default port is 25. RewriteDomain The domain from which mail seems to come. For user authentication. Hostname The full qualified name of the host. If not specified, the host is queried for its hostname. FromLineOverride Specifies whether the From header of an email, if any, may over- ride the default domain. The default is "no". UseTLS Specifies whether ssmtp uses TLS to talk to the SMTP server. The default is "no". UseSTARTTLS Specifies whether ssmtp does a EHLO/STARTTLS before starting SSL negotiation. See RFC 2487. TLSCert The file name of an RSA certificate to use for TLS, if required. AuthUser The user name to use for SMTP AUTH. The default is blank, in which case SMTP AUTH is not used. AuthPass The password to use for SMTP AUTH. AuthMethod The authorization method to use. If unset, plain text is used. May also be set to "cram-md5".