Hi all,<p>I usually have several cron jobs running in the background that output their results to text files. I then have to remember to check these files regularly. I figured it would be more productive to just send these to my e-mail.<p>I use Mac OS X, and I found ways to set up Gmail so that I can use the command-line `mail` client (http://www.anujgakhar.com/2011/12/09/using-macosx-lion-command-line-mail-with-gmail-as-smtp/). But all of these require me writing my Google password in cleartext (?!).<p>Do you know of a free service that I can set up for this purpose? Since I would only use it for piping the output of these cron jobs, I wouldn't mind writing the pass in cleartext.<p>I figured I could open up a Gmail account just for this purpose, but that somehow feels like a bit of a hack..
Cron already supports sending email for jobs (or at least the cron's on Unix/Linux machines do so). Just don't redirect the output anywhere and cron emails it to the owner of the cron job. Assuming that MacOS's cron is not too far modified, all you need is a replacement "sendmail" command, in the location that MacOS cron would look for it, that submits cron's output to an SMTP server for delivery.<p>Given that MacOS already ships with Tcl/Tk, if you install TclLib (<a href="http://wiki.tcl.tk/1246" rel="nofollow">http://wiki.tcl.tk/1246</a>) such that the native Tcl/Tk can find it (note, I have no Mac, so I have no knowledge of 'how' to install TclLib on MacOS) then you need a four line Tcl script to create a replacement "sendmail" command:<p><pre><code> #!/usr/bin/tclsh
package require mime
package require smtp
set mesg [::mime::initialize -string [read stdin]]
::smtp::sendmessage $mesg -servers smtp.server.name.com \
-client this.machines.name.com \
-originator email@address.to.use.as.from.com \
-recipients destination@email.address.com
</code></pre>
Replace 'smtp.server.name.com', 'this.machines.name.com', 'email@address.to.use.as.from.com', and 'destination@email.address.com' with the appropriate items for your environment and you (on Linux, at least) will be good to go. Hopefully MacOS's cron is not too far afield from standard Unix cron.
Both sendgrid.com and mailgun.com offer 10.000 emails/month for free. I use them inside cronjob scripts on cloud hosters where the standard sendmail/exim setup was too complicated or where the IP is blocked by various anti-spam lists.
I also found Nilas: <a href="https://www.nilas.com/" rel="nofollow">https://www.nilas.com/</a><p>It's not an SMTP server, but translates between REST calls and SMTP/IMAP commands (as far as I understand). So they store my Google credentials on their server, I keep an API key in cleartext, and use their infrastructure to both send and look at e-mails..<p>Anybody has experience with this?
Mandrill is a very good SMTP service. It's by the same people who do MailChimp<p>You can use traditional SMTP commands or use their API and it's free for up to 12,000 emails per month<p><a href="https://mandrill.com/" rel="nofollow">https://mandrill.com/</a>