<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>therning.org/ magnus &#187; fcron</title>
	<atom:link href="http://therning.org/magnus/archives/tag/fcron/feed" rel="self" type="application/rss+xml" />
	<link>http://therning.org/magnus</link>
	<description>Incoherent mumblings</description>
	<lastBuildDate>Mon, 09 Apr 2012 20:24:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using msmtp for a desktop system</title>
		<link>http://therning.org/magnus/archives/647</link>
		<comments>http://therning.org/magnus/archives/647#comments</comments>
		<pubDate>Fri, 05 Jun 2009 22:44:22 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[fcron]]></category>
		<category><![CDATA[msmtp]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=647</guid>
		<description><![CDATA[I read all my email via IMAP, and send all email via external SMTP servers, but at times it&#8217;s really useful to be able to run something like /usr/sbin/sendmail to send an email. Many tools depend on it, for me I want reports on cron jobs and I like using darcs send straight to an [...]]]></description>
			<content:encoded><![CDATA[<p>I read all my email via IMAP, and send all email via external SMTP servers, but at times it&#8217;s really useful to be able to run something like <code>/usr/sbin/sendmail</code> to send an email.  Many tools depend on it, for me I want reports on <code>cron</code> jobs and I like using <code>darcs send</code> straight to an email address.  For this a full-fledged SMTP server like exim/postfix/sendmail clearly is overkill.  First I had a quick look at <a href="http://www.archlinux.org/packages/extra/x86_64/ssmtp/">ssmtp</a> but it only allows for a system-wide configuration file.  Ideally I&#8217;d like &#8220;system-mails&#8221; (like <code>cron</code>) to be sent via my ISP while more personal emails should be sent via my Google account.  After a suggestion on the Arch mailing list I checked out <a href="http://www.archlinux.org/packages/extra/x86_64/msmtp/">msmtp</a> and it was exactly what I was looking for.</p>

<p>I created <code>/etc/msmtprc</code> with the following contents:</p>


<div class="wp_syntax"><div class="code"><pre class="foo" style="font-family:monospace;">defaults
logfile ~/.msmtp.log
&nbsp;
# MyISP
account myisp
host smtp.myisp.com
from my.email@myisp.com
&nbsp;
account default : myisp</pre></div></div>


<p>I then found out that [dcron][3] is severely limited; it doesn&#8217;t honour <code>MAILTO</code> in <code>crontabs</code> and it&#8217;s not possibly to use anything but <code>/usr/sbin/sendmail</code> to send emails.  The lack of support for <code>MAILTO</code> is the deal breaker in this case.</p>

<p>Rather than create a symbolic link I modified <code>fcron</code>&#8216;s configuration file, <code>/etc/fcron/fcron.conf</code>, to use <code>/usr/bin/msmtp</code>:</p>


<div class="wp_syntax"><div class="code"><pre class="foo" style="font-family:monospace;">sendmail = /usr/bin/msmtp</pre></div></div>


<p>I also made sure to stick <code>MAILTO=my.email@myisp.com</code> in the system <code>crontab</code>, using <code>fcrontab -u systab -e</code>.</p>

<p>Then I created the file <code>~/.msmtprc</code>:</p>


<div class="wp_syntax"><div class="code"><pre class="foo" style="font-family:monospace;">defaults
logfile ~/.msmtp.log
&nbsp;
# MyISP
account mysisp
host smtp.myisp.com
from my.email@myisp.com
&nbsp;
# google
account google
host smtp.gmail.com
from user@googlemail.com
tls on
tls_certcheck off
auth on
user user@googlemail.com
password MySecretPassword
&nbsp;
account default : google</pre></div></div>


<p>Finally I put <code>MAILTO=user@googlemail.com</code> in my user&#8217;s <code>crontab</code>.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Ftherning.org%2Fmagnus%2Farchives%2F647&amp;title=Using%20msmtp%20for%20a%20desktop%20system" id="wpa2a_2">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/647/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

