Use mailsend to send email from the Terminal

Filed under:

Update: After this article was written I learned of mstmp which I highly recommend instead of mailsend.

There are times that I want my iMac to be able to email me: when certain scripts run via cron or launchd, when certain events happen (a backup has been completed), etc. I’ve found that none of the included command-line programs work.

The good news is that, with a UNIX foundation, it was fairly easy to find a free program which would do just that.

A little searching turned up a free program called mailsend, which will work. For this example I will be using a Gmail account, which requires OpenSSL. Your mail server may not require OpenSSL support, but if it’s possible, I encourage you to use it.

The short version of the instructions are as follows:

1) Download and install OpenSSL to /usr/local/ssl/

2) Download and install mailsend to somewhere in your path such as /usr/local/bin/

3) Use mailsend -h to learn how to use it on the commandline

4) (Optional) Use TextExpander 3 to fill in some of the variable fields, such as To, Subject, and Message.

Read on for more of a step by step walk-through.

TUAWUse mailsend to send email from the Terminal originally appeared on The Unofficial Apple Weblog (TUAW) on Mon, 03 May 2010 11:00:00 EST. Please see our terms for use of feeds.

Read | Permalink | Email this | Comments