I have been recently working on a few interesting projects, one which requires sending emails from servers with some attached files, while using Office365 email. While trying to make things easier I started to look for a better way to configure email than sendmail or procmail and settled on ssmtp.
ssmtp is a light weight email system which can be used to configure outbound email from a server, and use a 3rd party relay system like google or Microsoft Office365.
To install it,all you need is EPEL enabled in yum, the run “yum install ssmtp”
Next, edit the config file /etc/ssmtp/ssmtp.conf, here is my sample file, with the email address and password hidden. This example sends email out via Office365.
- root is my email address
- AuthUser is also my email address
- AuthPass is my Office365 password
- ReWriteDomain is my domain
I also used the alternatives command to make ssmtp the default email program
Next I just send an email. In this case, I am using mailx to send the dmesg file to run some diagnostics. I use the -r option to set the from address, and the –a option to attach the file.