Enabling Email Notifications

Get Email notifications with the completion status of backup jobs by pointing Zmanda to your SMTP server.

Prerequisite - SMTP Server

You must have an operational SMTP server as well as its credentials. Zmanda, itself, will not act as the SMTP server.

If you aren't sure where to start, see this article on how to set up an SMTP server using Gmail.

You will use the SMTP server information to configure the mailx/postfix tools in the following steps.

RHEL Based Systems

  1. Install mailx package using yum or dnf

sudo dnf install mailx
  1. Create a soft link to mailx from mail.

ln -s /bin/mailx /bin/mail
  1. Update the /etc/mail.rc configuration as below:

//append the following line in mail.rc   

//set smtp=smtp://smtp.server.tld:<port_number> 
set smtp=smtp.office365.com:25

//tell mailx that it needs to authorise  
set smtp-auth=login  
set smtp-use-starttls

//set the user for SMTP  
//set [email protected]
set [email protected] //user account
set [email protected] //user account

//set the password for authorization  
set smtp-auth-password= <PASSWORD of user account> 
set nss-config-dir=/etc/pki/nssdb/  
set ssl-verify=ignore  
  1. Test to make sure that everything works as expected:

echo "Your message" | mail -s "Message Subject" [email protected]
  1. Install the utility

apt-get install postfix mailutils 
  1. In /etc/postfix/main.cf, append the following lines. Use a text editor tool like vi or nano. eg. vi /etc/postfix/main.cf

relayhost = [smtp.office365.com]:25  
mynetworks = 127.0.0.0/8  
inet_interfaces = loopback-only  
smtp_use_tls = yes  
smtp_always_send_ehlo = yes  
smtp_sasl_auth_enable = yes  
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd  
smtp_sasl_security_options = noanonymous  
smtp_sasl_tls_security_options = noanonymous  
smtp_tls_security_level = encrypt  
smtp_generic_maps = hash:/etc/postfix/generic  
  1. Configure the postfix SASL credentials by appending the following info within /etc/postfix/sasl_passwd:

[smtp.office365.com]:25 user@domainname:password  
  1. A Postfix lookup table must now be generated from the sasl_passwd text file by running the following commands.

postmap /etc/postfix/sasl_passwd  

//Change permissions and ownership for this file  
chown root:postfix /etc/postfix/sasl_passwd  
chmod 640 /etc/postfix/sasl_passwd 
  1. Next, we need to configure generic file in order to be able to send emails as a valid user (this is required for Office365). vi or nano into /etc/postfix/generic and append the following info:

@hostname [email protected]
  1. Save and exit the file and run the following commands.

chown root:root /etc/postfix/generic  
chmod 0600 /etc/postfix/generic  
postmap /etc/postfix/generic  
  1. Now Change alias root to your email address. Use vi or nano to make the following changes to /etc/aliases

mailer-daemon:  postmaster  
postmaster:     root  
root:           
[email protected]
  1. Save and exit, and run the newaliases command for the changes to take effect.

newaliases  
systemctl restart postfix.service
  1. Send a test email using the command below:

echo "This is the body of the email" | mailx -s "This is the subject line" [email protected] -a "FROM: [email protected]"  

Last updated