A better way to send emails from Linux

Share this post on:

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.

image

  • 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

image

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.

image

Author: admin

Erik is currently an Oracle ACE Director and VP of Enterprise Transformation at Mythics, serving as a lead strategist for Federal, State and Local Government and Commercial customers throughout the United States. These customer engagements include enterprise cloud transformations, data center consolidation and modernization efforts, Big Data projects and implementations of Oracle Engineered Systems. He is a board member of the DC metro area National Capital Oracle User Group, a board member of the Independent Oracle Users Group (IOUG), Cloud Computing Special Interest Group (SIG) and he is actively involved with the Oracle Enterprise Manager SIGs. Erik presents frequently at conferences, including Oracle OpenWorld, Oracle FedForum, COLLABORATE and other user groups and conferences around the United States. He has worked with Oracle and Sun Systems since the mid 90s, and is experienced with most of the core Oracle technologies.

When not flying to the far points of the country from the Atlanta Metro area, he enjoys spending time with his family at their observatory, where the telescopes outnumber the people.

View all posts by admin >

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.