<rss version="2.0">
  <channel>
    <title>Nicolas Pouillard&#39;s Blog</title>
    <link>http://blog.nicolaspouillard.fr</link>
    <description>Nicolas Pouillard&#39;s Blog</description>
    <item>
      <title>Simple E-Mail Delaying</title>
      <link>http://blog.nicolaspouillard.fr/entries/2009-10-03-simple-email-delaying.html</link>
      <description>&lt;p&gt;Yesterday I have finally scratch an itch that was bugging me since months. And guess what it fits in less than 40 lines of shell script!&lt;/p&gt;&lt;div id=&quot;e-mail-driven-actions&quot;&gt;&lt;h2&gt;E-Mail Driven Actions&lt;/h2&gt;&lt;p&gt;I tend to be quite bad at managing tasks to do, however I try improve myself, and already follow two simple rules. The first one is called the &amp;quot;two minutes rule,&amp;quot; it says that if one thing you have to do takes less than two minutes, then it does not worth to be delayed, you should do it now! The second rule I apply is to do tasks when it pops-up in my email client (&lt;a href=&quot;http://sup.rubyforge.org/&quot;&gt;sup&lt;/a&gt;).&lt;/p&gt;&lt;p&gt;However from time to time, I receive an email which incurs a &amp;quot;more than two minutes&amp;quot; action, that I cannot cope with now. If I keep that email in my in-box, it will keep bugging me until I either pick it up or trash it because it is now outdated.&lt;/p&gt;&lt;/div&gt;&lt;div id=&quot;delaying&quot;&gt;&lt;h2&gt;Delaying&lt;/h2&gt;&lt;p&gt;The feature I often wanted is to be able to delay an email-based action, without having to pick it up myself in the pool of waiting emails. More precisely I really enjoy the event based approach of email processing, it is just that some emails come at the wrong time.&lt;/p&gt;&lt;p&gt;In this kind of situation I would like to say, &amp;quot;bring me that email again in two days&amp;quot; or &amp;quot;this evening&amp;quot; or &amp;quot;2 days before &lt;deadline&gt;&amp;quot; or &amp;quot;when in vacations&amp;quot; or &amp;quot;when back online&amp;quot;... This way you can keep both your in-box clean (&lt;a href=&quot;http://inboxzero.com/video/&quot;&gt;in-box-zero&lt;/a&gt;) and continue to follow an event based style of reacting.&lt;/p&gt;&lt;p&gt;This technique can also be useful to passively distribute the answer to a question among a group on a mailing-list. If you feel not the most concerned about the question then you can say &amp;quot;let&#39;s wait two days,&amp;quot; and answer something if no one took it before!&lt;/p&gt;&lt;/div&gt;&lt;div id=&quot;getting-delaying-into-sup&quot;&gt;&lt;h2&gt;Getting Delaying Into Sup&lt;/h2&gt;&lt;p&gt;The next point was to actually have the feature in the email client I use. However I didn&#39;t really take the time to implement this. It seemed quite easy but a bit tedious and with a bunch of design choice: Where to store reminders, how often do we check them, do we poll, do we use threads, timers...&lt;/p&gt;&lt;/div&gt;&lt;div id=&quot;bam-unix-philosophy-to-the-rescue&quot;&gt;&lt;h2&gt;BAM! Unix Philosophy To The Rescue&lt;/h2&gt;&lt;p&gt;During months, instead of actually coding this not-too-complex module, I was procrastinating. However this was not vain, since I got a better idea. What if we could make this feature independent of the email client? Even better I could reuse and compose existing tools!&lt;/p&gt;&lt;p&gt;So, the usage is as follow: you are on a discussion, and you want to delay processing it. In sup you press &#39;|&#39; to pipe the current email to a given program. I have named that command &lt;a href=&quot;http://gist.github.com/199197&quot;&gt;email-reminder&lt;/a&gt;. It reads the email, extracts the &lt;code&gt;Message-ID&lt;/code&gt; and setups a task at the given time specification. The task is simply to reply to the email using the &lt;code&gt;Message-ID&lt;/code&gt;. The time specification is the one defined by the &lt;a href=&quot;http://en.wikipedia.org/wiki/At_(Unix)&quot;&gt;&lt;code&gt;at(1)&lt;/code&gt;&lt;/a&gt; Unix command.&lt;/p&gt;&lt;/div&gt;&lt;div id=&quot;about-the-script&quot;&gt;&lt;h2&gt;About the script&lt;/h2&gt;&lt;p&gt;The script first extracts the &lt;code&gt;Message-ID&lt;/code&gt; (and the &lt;code&gt;Subject&lt;/code&gt;) of the input mail. Then it cooks up a little response email, using your email and the current date, generating a &lt;code&gt;Message-ID&lt;/code&gt; and the &lt;code&gt;In-Reply-To&lt;/code&gt; field. Finally it runs the &lt;a href=&quot;http://en.wikipedia.org/wiki/At_(Unix)&quot;&gt;&lt;code&gt;at(1)&lt;/code&gt;&lt;/a&gt; command, feeding it with the time specification and a call to the &lt;code&gt;$SENDMAIL&lt;/code&gt; or &lt;a href=&quot;http://msmtp.sourceforge.net/&quot;&gt;&lt;code&gt;msmtp(1)&lt;/code&gt;&lt;/a&gt; command.&lt;/p&gt;&lt;p&gt;This little script is now published on &lt;a href=&quot;http://gist.github.com/199197&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;</description>
      <pubDate>2009-10-03 00:00:00 UTC</pubDate>
    </item>
  </channel>
</rss>
