Mail server setup

Table of contents
No headers

 

For CentOS, RHEL, OEL, Fedora and Suse Linux systems kindly follow the below procedure to enable mailx on Zmanda server: 

 

1.       Install mailx package  

 

#yum install mailx 

 

2.       Create a soft link to mailx from mail. 

 

     #ln -s /bin/mailx /bin/mail 

 

3.       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 authorisation 

set smtp-auth-password= “PASSWORD of user account” 

set nss-config-dir=/etc/pki/nssdb/ 

set ssl-verify=ignore 

 

4.       To test the functionality.  

 

#echo "Your message" | mail -s "Message Subject" [email protected] 

 

 

For Ubuntu & Debian Linux systems, follow the below procedure to enable mailx on Zmanda server: 

 

 

1.       apt-get install postfix mailutils 

 

2.       root@U16:~# vi /etc/postfix/main.cf 

             Append the following line 

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 

 

3.       postfix SASL credentials configuration: 

root@U16:~# vi /etc/postfix/sasl_passwd 

Append following info. 

[smtp.office365.com]:25 user@domainname:password 

 

4.       A Postfix lookup table must now be generated from the sasl_passwd text file by running the following command. 

root@U16:~# postmap /etc/postfix/sasl_passwd 

Now change permission for this file 

root@U16:~# chown root:postfix /etc/postfix/sasl_passwd 

root@U16:~# chmod 640 /etc/postfix/sasl_passwd 

 

5.       Next, we need to configure generic file in order to be able to send emails as a valid user (this is required for Office365). 

root@U16:~# vi /etc/postfix/generic 

Append following info. 

@hostname [email protected] 

 

Save and exit from file. 

root@U16:~# chown root:root /etc/postfix/generic 

root@U16:~# chmod 0600 /etc/postfix/generic 

root@U16:~# postmap /etc/postfix/generic 

 

6.       Now Change alias root to your email address. 

root@U16:~ vi /etc/aliases 

 

Make the changes like below: 

mailer-daemon:  postmaster 

postmaster:     root 

root:           [email protected] 

 

7.       Run command newaliases to take effect. 

root@U16:~ newaliases 

root@U16:~# systemctl restart postfix.service 

 

8.       send a test email using the command below: 

echo "This is the body of the email" | mailx -s "This is the subject(E-Mail from SMTP Relay)     line" [email protected] -a "FROM: [email protected]"