==== MSMTP mail client ==== The MSMTP mail client is a small program capable of sending messages. I use it for sending messages from my server. My working configuration is below. (password have been removed) === Config file ''/etc/msmtprc'' === # default values defaults auth on tls on # for debian based systems tls_trust_file /etc/ssl/certs/ca-certificates.crt # for rhel based systems #tls_trust_file /etc/pki/tls/certs/ca-bundle.crt #tls_starttls off logfile /var/log/msmtp.log # Syslog logging with facility LOG_MAIL instead of the default LOG_USER. syslog LOG_MAIL aliases /etc/aliases # one.com account one host send.one.com port 465 from no-reply@example.com user no-reply@example.com password auto_from off domain example.com tls_starttls off # Set default account account default : one === example mail file === Create a text file named "email.txt" and put some content in it. To: me@example.com From: no-reply@example.com Subject: Email test from CLI Hi, This is a test message from my server. === Command run === Send a test email with this command. Please note that when send as normal user the log file is not accessible. john@server:/tmp$ cat email.txt |msmtp -a one me@example.com msmtp: cannot log to /var/log/msmtp.log: cannot open: Permission denied msmtp: log info was: host=send.one.com tls=on auth=on user=no-reply@example.com from=no-reply@example.com recipients=me@example.com mailsize=154 smtpstatus=250 smtpmsg='250 2.0.0 Ok: queued as 616eb246-fabb-11e8-b718-d0431ea8a290' exitcode=EX_OK ==== Using Mutt ==== Sending email using msmtp is all well and good but if you want to send a message with an attachment it just won't do it. That's where Mutt comes into the picture. Typically installing mutt can be done with either "**yum install mutt**" or "**apt install mutt**". You don't need to configure anything, but the from field of your message will then be username@server. if you create a config file you can set the from field to anything you like. Create the file ///root/.muttrc// if it does not exist. set use_from=yes set realname=”no-reply” set from=no-reply@example.com set envelope_from=yes note: if the realname contains a space you should set the value in both double quotes and single quotes. e.g set realname="'John Doe'" === Command run === A test email can be send with the following command. (test.txt is the file to attach and body.text is the message body) john@server:~$ mutt -s "Testing Mutt" -a test.txt -- recipient@example.com < ./body.txt