E-mail library for Ruby?

  • Thread starter Just Another Victim of the Ambient Morality
  • Start date
J

Just Another Victim of the Ambient Morality

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...
 
D

Damjan Rems

Just said:
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
 
R

Richard Conroy

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)
 
A

ara.t.howard

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...

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
 
A

Alex LeDonne

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:
http://kb.iu.edu/data/aixg.html (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. :)

-Alex
 
J

Just Another Victim of the Ambient Morality

Alex LeDonne said:
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:
http://kb.iu.edu/data/aixg.html (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. :)

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

Dimitri Aivaliotis

On 3/21/07, Just Another Victim of the Ambient Morality
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 sup[1] to label, sort, and
search. It's Gmail for the command-line, written in Ruby.

- Dimitri

[1]: http://sup.rubyforge.org/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top