From mboxrd@z Thu Jan 1 00:00:00 1970 From: Erik Hetzner Subject: Re: processing pending emails as part of your GTD system Date: Wed, 23 Apr 2008 12:25:17 -0700 Message-ID: <87k5iope5e.wl%erik.hetzner@ucop.edu> References: <24266.1208760913@localhost> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="===============0513603025==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JokY7-00052O-JX for emacs-orgmode@gnu.org; Wed, 23 Apr 2008 15:22:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JokY4-000524-Lq for emacs-orgmode@gnu.org; Wed, 23 Apr 2008 15:22:34 -0400 Received: from [199.232.76.173] (port=34552 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JokY4-000521-He for emacs-orgmode@gnu.org; Wed, 23 Apr 2008 15:22:32 -0400 Received: from wr-out-0506.google.com ([64.233.184.234]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JokY4-0004U3-2c for emacs-orgmode@gnu.org; Wed, 23 Apr 2008 15:22:32 -0400 Received: by wr-out-0506.google.com with SMTP id 57so1918425wri.12 for ; Wed, 23 Apr 2008 12:22:29 -0700 (PDT) In-Reply-To: <24266.1208760913@localhost> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode mailing list --===============0513603025== Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Wed_Apr_23_12:25:16_2008-1"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --pgp-sign-Multipart_Wed_Apr_23_12:25:16_2008-1 Content-Type: multipart/mixed; boundary="Multipart_Wed_Apr_23_12:25:16_2008-1" --Multipart_Wed_Apr_23_12:25:16_2008-1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable At Mon, 21 Apr 2008 07:55:13 +0100, Pete Phillips wrote: > This post is slighly off-topic, as it is not directly about org-mode. >=20 > As many of you on the list will know, I'm a big fan of David Allen's GTD > system, and over the years I have tweaked my use of MH and MH-E to help > support this use. >=20 > One thing I have done is design a method so that I can easily put emails > into a set of 'pending' mail folders, and then get cron to process these > and dump the emails back into my +inbox at appropriate dates. > > [=E2=80=A6] This is a neat trick. I=E2=80=99m giving it a try to help me keep my inbox = as empty as possible. However, I use IMAP & Wanderlust. Attached is a quick Ruby script that should provide similar functionality for any IMAP system, and some cron entries to call it, for anybody who wants it. This works for me, but I have commented out the lines in the script which actually delete mail from one mailbox; I don=E2=80=99t want to be responsible for losing ma= il. The mailboxes used by the cron entries are (a little different from yours): pending/tomorrow pending/tonight pending/nextweek pending/d01 .. pending/day31 pending/january .. pending/december pending/monday .. pending/sunday today Hope this helps somebody. best, Erik Hetzner --Multipart_Wed_Apr_23_12:25:16_2008-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="crontab-example" Content-Transfer-Encoding: 7bit IMAP_PASSWORD=... IMAP_USER=... IMAP_HOST=... IMAP_INBOX=INBOX ############################################################# # Mail Section ############################################################# ### Each month, refile all the pending stuff back to my inbox. ### 00:01 on the first day of each month 1 0 1 * * $HOME/bin/imap-dump-folder.rb pending/`date +\%B | tr A-Z a-z` $IMAP_INBOX ### Each monday at 00:02 refile all the next-week stuff 2 0 * * 1 $HOME/bin/imap-dump-folder.rb pending/nextweek $IMAP_INBOX ### Each day also has its own pending - Saturday, Sunday etc 3 0 * * * $HOME/bin/imap-dump-folder.rb pending/`date +\%A | tr A-Z a-z` $IMAP_INBOX ### Each date of the month (1-31) also has its own pending - d01, d11, d31 etc 4 0 * * * $HOME/bin/imap-dump-folder.rb pending/d`date +\%d` $IMAP_INBOX ### Each night at 17:30 - refile all pending/tonight to INBOX 30 17 * * * $HOME/bin/imap-dump-folder.rb pending/tonight $IMAP_INBOX ### Each night at 12:30 - refile all today stuff back to INBOX 30 00 * * * $HOME/bin/imap-dump-folder.rb today $IMAP_INBOX # Each day refile the tomorrow pending back to INBOX 5 0 * * * $HOME/bin/imap-dump-folder.rb pending/tomorrow $IMAP_INBOX --Multipart_Wed_Apr_23_12:25:16_2008-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="imap-dump-folder.rb" Content-Transfer-Encoding: 7bit #!/usr/bin/env ruby require 'net/imap' #defaults host = ENV['IMAP_HOST'] || '' port = (ENV['IMAP_PORT'] || '143').to_i use_ssl = !(ENV['IMAP_SSL'].nil?) user = ENV['IMAP_USER'] || '' password = ENV['IMAP_PASSWORD'] || '' source_folder = "" target_folder = "" help_me = false def imap_dump_folder(host, port, use_ssl, user, password, source_folder, target_folder) imap = Net::IMAP.new(host, port, use_ssl) imap.login(user, password) imap.select(source_folder) (1..imap.responses["EXISTS"][-1]).each do |mid| imap.copy(mid, target_folder) #imap.store(mid, "+FLAGS", [:Deleted]) end #imap.expunge() end def usage(do_exit = true) STDERR.print "usage: #{$0} [options] source target --host=string host server name --port=string host server port --ssl use ssl --user=string username --password=string password --help show this message. " exit if do_exit end ARGV.each do |option| case (option) when /^--host=(.+)/ host = $1 when /^--port=([0-9]+)/ port = $1.to_i when /^--user=(.+)/ user = $1 when /^--password=(.+)/ password = $1 when /^--ssl/ use_ssl = true when /^--help/ help_me = true when /^(.+)/ if (source_folder == '') then source_folder = $1 elsif (target_folder == '') then target_folder = $1 else usage() end else usage() end end if (host == "" or user == "" or password == "" or source_folder == "" or target_folder == "" or help_me == true) then usage(true) end imap_dump_folder(host, port, use_ssl, user, password, source_folder, target_folder) --Multipart_Wed_Apr_23_12:25:16_2008-1-- --pgp-sign-Multipart_Wed_Apr_23_12:25:16_2008-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBID40chkChe2G3k3oRAnQQAJ4gg+0bYQd0LaAajerilIf2I0hadACgpeAH vbDK1z6j6aih6uY6O3+XHJ8= =+ap9 -----END PGP SIGNATURE----- --pgp-sign-Multipart_Wed_Apr_23_12:25:16_2008-1-- --===============0513603025== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0513603025==--