Don’t bother configuring postfix or sendmail, openssl related stuff and so on when you are in the need of a quick way to send e-mail from CLI ie. for your administrative scripts.

You can accomplish it in a few steps using mutt. If your distribution didn’t come with mutt, go grab it via yum or apt-get or compile from source Once you got mutt, create a .muttrc file under your user home with the following content: [ obviously you must change username and password accordingly with your personal credentials ]

# character set on messages that we send
set send_charset="utf-8"

# personality settings
set realname = "**DESIRED*DISPLAY*NAME**"
set from = "**YOUR*USERNAME**"

# IMAP settings
set imap_user = "**YOUR*USERNAME**"
set imap_pass = "**YOUR*PASSWORD**"
set folder = "imaps://"
set spoolfile = "+INBOX"
set postponed ="+[Gmail]/Drafts"
set imap_keepalive=900
# use headercache for IMAP 
set header_cache =/var/tmp/.mutt/cache/headers
set message_cachedir =/var/tmp/.mutt/cache/bodies
set certificate_file =/var/tmp/.mutt/certificates
# SMTP mailing configuration (for sending mail)
set smtp_url = "smtp://**YOUR*USERNAME**"
set smtp_pass = "**YOUR*PASSWORD**"

Remember to create the cache path: $ mkdir -p /var/tmp/.mutt/cache/ You also must accept Google Mail SSL certificate or e-mails will never leave your box. To do so, fire up mutt: $ mutt It will present you with this dialog: image

Press “a” to (a)ccept always. Then press “q” to quit mutt. Now you can test sending an email: $ mutt -s “Subject” < message.txt  You may also attach a file: $ mutt -s “subject of the email” < message.txt -a /path/to/attachment/MyDoc.pdf Obviously at this point you may integrate the above mutt command into your shell scripts: only limit is your imagination. :)