Discussions of development and use of the Sup email client
 help / color / mirror / Atom feed
From: Matthew Bloch <matthew@bytemark.co.uk>
To: supmua@googlegroups.com
Subject: Re: Best hacks for multiple sent_source folders
Date: Mon, 29 Dec 2014 06:21:18 -0800 (PST)	[thread overview]
Message-ID: <4dd537d6-3651-4040-b313-c271e0842fbe@googlegroups.com> (raw)
In-Reply-To: <d4b89c3f-9010-438a-804f-7c7d18d4134e@googlegroups.com>


[-- Attachment #1.1: Type: text/plain, Size: 1002 bytes --]

Well, I'm not too proud, but this on a cron job does what I need! If I get 
some time to dig into the sup source, I might have a stronger opinion about 
how/whether to integrate this sort of thing. My instinct is "no", sup copes 
with messages being moved around under it, and offlineimap does the right 
thing too.

#!/usr/bin/ruby
require 'mail'

BASE = "/home/mattbee/mail"

SOURCE = "#{BASE}/sup.sent"

FROM_ADDRESS_TO_SENT_FOLDER_MAP = {
  "matthew@work" => "#{BASE}/Work/Sent",
  "matthew@personal" => "#{BASE}/Personal/Sent",
  "matthew@othercompany" => "#{BASE}/Othercompany/Sent"
}

%w( cur new ).each do |d|
  d = "#{SOURCE}/#{d}"
  Dir.new(d).entries.each do |e|
    f = "#{d}/#{e}"
    next unless File.file?(f)
    mail = Mail.read(f)
    maildir = FROM_ADDRESS_TO_SENT_FOLDER_MAP[mail.from.first]
    if !maildir
      STDERR.print "Unknown From address in #{f}\n"
    else
#      STDERR.print "Moving #{f} to #{maildir}\n"
      File.rename(f, "#{maildir}/cur/#{e}")
    end
  end
end



[-- Attachment #1.2: Type: text/html, Size: 1334 bytes --]

      parent reply	other threads:[~2014-12-29 14:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-21  4:17 Matthew Bloch
2014-12-22 11:23 ` [sup] " Ruthard Baudach
2014-12-24 11:31   ` Gaute Hope
2014-12-29 14:21 ` Matthew Bloch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4dd537d6-3651-4040-b313-c271e0842fbe@googlegroups.com \
    --to=matthew@bytemark.co.uk \
    --cc=supmua@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox