E-mail library for Ruby?

Okay, I’ll detail my problem and, hopefully, people can suggest a
solution to me.
I have an account on a Linux machine that I use as my e-mail
address. I
use Pine as my mail client. I have let my inbox accumulate e-mail for
years
and there is now too much e-mail queued up for my tastes. Now, I don’t
want
to delete my e-mail. Instead, I want archive it to various e-mail
folders
like how I would have if I used Pine. I could do this by hand, using
Pine,
except that there is simply too much e-mail for me to do this in any
reasonable time.
So, I think my solution is to automate this sorting using something
like
Ruby and an appropriate library. Does anyone know what Ruby library I’m
looking for?
Thank you…

Just Another Victim of the Am Morality wrote:

Okay, I’ll detail my problem and, hopefully, people can suggest a
solution to me.
I have an account on a Linux machine that I use as my e-mail
address. I
use Pine as my mail client. I have let my inbox accumulate e-mail for
years
and there is now too much e-mail queued up for my tastes. Now, I don’t
want
to delete my e-mail. Instead, I want archive it to various e-mail
folders
like how I would have if I used Pine. I could do this by hand, using
Pine,
except that there is simply too much e-mail for me to do this in any
reasonable time.
So, I think my solution is to automate this sorting using something
like
Ruby and an appropriate library. Does anyone know what Ruby library I’m
looking for?
Thank you…

If You have imap access you can do this. This is excerpt from my program
which is cleaning postmaster box.

aDelete=Array.new
aMove=Array.new
imap = Net::IMAP.new(‘mail.domain.com’)
imap.login(‘user’, ‘pwd’)
imap.select(‘Inbox’)
n = imap.search([“SINCE”, “1-Jan-1969”])
listInbox = imap.fetch(n, [“ENVELOPE”,“UID”] )
listInbox.each do | a |
if (a.attr[“ENVELOPE”].subject[0…14] == “Discarded Mail:” or
a.attr[“ENVELOPE”].subject[0…16] == “Quarantined Mail:”) then
aMove.push(a.attr[“UID”]) # either move
aDelete.push(a.attr[“UID”]) # or delete
end
end

Move to other folder

if aMove.length > 0
imap.uid_copy(aMove,“FolderToMove”)
imap.uid_store(aMove, “+FLAGS”, [:Deleted])
end

Delete msgs

imap.uid_store(aDelete, “+FLAGS”, [:Deleted]) if aDelete.length > 0

Expunge msgs marked for deletion

imap.expunge
imap.close

by

TheR

I forgot. You must also add
require ‘net/imap’
at the top.

by

TheR

On Wed, 21 Mar 2007, Just Another Victim of the Ambient M. wrote:

Thank you…
you are looking for tmail. let me warn you, however, that it’s very
easy
to blow away your mail while learning this library - be sure to make a
backup
first!

cheers.

-a

On 3/21/07, Just Another Victim of the Ambient M.
[email protected] wrote:

So, I think my solution is to automate this sorting using something like

Ruby and an appropriate library. Does anyone know what Ruby library I’m
looking for?

Well there’s POP3 libraries too, in addition to IMAP. And they ship
with with Ruby.
You can probably find 3rd party libraries too that are effective in
more niche mail
formats.

I would presume that you might end up using some kind of subject line
pattern
matching to sort the email (especially useful for mailing lists)

“Alex LeDonne” [email protected] wrote in message
news:[email protected]

to delete my e-mail. Instead, I want archive it to various e-mail
In Pine, how do I enable aggregate commands? (In Pine, how do I enable aggregate

Since you’re already familiar with Pine, then using the aggregate
command set, I think you could, in fact, do this in a reasonable
amount of time by hand. :slight_smile:

This looks very promising, thank you.
I'm a little embarrassed using a non-Ruby solution solicited from a 

Ruby
newsgroup…

On 3/21/07, Just Another Victim of the Ambient M.
[email protected] wrote:

Okay, I'll detail my problem and, hopefully, people can suggest a

solution to me.
I have an account on a Linux machine that I use as my e-mail address. I
use Pine as my mail client. I have let my inbox accumulate e-mail for years
and there is now too much e-mail queued up for my tastes. Now, I don’t want
to delete my e-mail. Instead, I want archive it to various e-mail folders
like how I would have if I used Pine. I could do this by hand, using Pine,
except that there is simply too much e-mail for me to do this in any
reasonable time.

For the record: In Pine, you can enable aggregate commands, select
messages by criteria, then move them in bulk.

For step-by-step instructions to get started:
In Pine, how do I enable aggregate commands? (In Pine, how do I enable aggregate
commands?)
http://kb.iu.edu/data/afsx.html (In Pine, how do I perform an action
(like saving or printing) on a large number of messages at once?)

For further adventures:
http://www.google.com/search?&q=pine+enable+aggregate+command+set

You can then do things like select all the messages with “ruby-talk”
in the to field, and apply the save command to save them all to a
folder.

Since you’re already familiar with Pine, then using the aggregate
command set, I think you could, in fact, do this in a reasonable
amount of time by hand. :slight_smile:

-Alex

On 3/21/07, Just Another Victim of the Ambient M.

So, I think my solution is to automate this sorting using something like

Ruby and an appropriate library. Does anyone know what Ruby library I’m
looking for?

You could keep your inbox as-is, and use sup1 to label, sort, and
search. It’s Gmail for the command-line, written in Ruby.

  • Dimitri