TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Free,reliable SMTP service for sending emails from cron jobs in Mac OS X

3 点作者 graffitici超过 10 年前
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:&#x2F;&#x2F;www.anujgakhar.com&#x2F;2011&#x2F;12&#x2F;09&#x2F;using-macosx-lion-command-line-mail-with-gmail-as-smtp&#x2F;). 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&#x27;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..

5 条评论

pwg超过 10 年前
Cron already supports sending email for jobs (or at least the cron&#x27;s on Unix&#x2F;Linux machines do so). Just don&#x27;t redirect the output anywhere and cron emails it to the owner of the cron job. Assuming that MacOS&#x27;s cron is not too far modified, all you need is a replacement &quot;sendmail&quot; command, in the location that MacOS cron would look for it, that submits cron&#x27;s output to an SMTP server for delivery.<p>Given that MacOS already ships with Tcl&#x2F;Tk, if you install TclLib (<a href="http://wiki.tcl.tk/1246" rel="nofollow">http:&#x2F;&#x2F;wiki.tcl.tk&#x2F;1246</a>) such that the native Tcl&#x2F;Tk can find it (note, I have no Mac, so I have no knowledge of &#x27;how&#x27; to install TclLib on MacOS) then you need a four line Tcl script to create a replacement &quot;sendmail&quot; command:<p><pre><code> #!&#x2F;usr&#x2F;bin&#x2F;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 &#x27;smtp.server.name.com&#x27;, &#x27;this.machines.name.com&#x27;, &#x27;email@address.to.use.as.from.com&#x27;, and &#x27;destination@email.address.com&#x27; with the appropriate items for your environment and you (on Linux, at least) will be good to go. Hopefully MacOS&#x27;s cron is not too far afield from standard Unix cron.
评论 #9087453 未加载
mtmail超过 10 年前
Both sendgrid.com and mailgun.com offer 10.000 emails&#x2F;month for free. I use them inside cronjob scripts on cloud hosters where the standard sendmail&#x2F;exim setup was too complicated or where the IP is blocked by various anti-spam lists.
graffitici大约 10 年前
I also found Nilas: <a href="https://www.nilas.com/" rel="nofollow">https:&#x2F;&#x2F;www.nilas.com&#x2F;</a><p>It&#x27;s not an SMTP server, but translates between REST calls and SMTP&#x2F;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?
garyharrower超过 10 年前
Mandrill is a very good SMTP service. It&#x27;s by the same people who do MailChimp<p>You can use traditional SMTP commands or use their API and it&#x27;s free for up to 12,000 emails per month<p><a href="https://mandrill.com/" rel="nofollow">https:&#x2F;&#x2F;mandrill.com&#x2F;</a>
评论 #9092245 未加载
jlgaddis大约 10 年前
AIUI, you&#x27;re basically asking for a (free) open relay. There are very good reasons why those are pretty much non-existent nowadays. Good luck.