[REBOL] Fetch emmail headers & selective deletion
From: philb::upnaway::com at: 22-Aug-2003 20:59
Hi,
Dont know if this is of any use to anyone .... but I have created a view front end to
the code below.
It will also allow selection & deletion of Emails that have yet to be downloaded from
the your POP server.
http://www.upnaway.com/~philb/philip/headers.r
Usefull if someone sends you a very large email that you dont want to (or cant) download.
Any comments/suggestions are welcome ....
*** Warning ***
Obviously take care when deleting email from the server ... you cant get it back!
Also take care not to run more than 1 copy of the program at once ....
*** Warning ***
Cheers Phil
=== Original Message ===
Hi Rene,
Think you can do it.
Cant remeber where this code came from .... (RT I think)
--------------------------------------------------------------------
attempt: does [
pop: open pop://user:[password--mail--server--com]/
lv-msgs: pop/locals/msg-nums
foreach mesg-num lv-msgs [
print ["Message" mesg-num]
insert pop/sub-port rejoin [ "TOP " pick pop/locals/msg-nums pop/state/index + mesg-num
" 0" ]
net-utils/confirm pop/sub-port [ none "+OK" ]
headers: pop/handler/read-til-dot pop make string! 1024
lv-em: import-email headers
print lv-em/date
]
close pop
]
attempt
--------------------------------------------------------------------
Just need to add the deletion code.
Cheers Phil
=== Original Message ===
Hi Rene,
RSB> I try to write a "fetchmail"-clone. In the "library" I found some few-liners
RSB> for deleting mail on the
RSB> mail-server. But I want to delete mail older than 5 day and sometimes mail
RSB> with a specific "subject".
RSB> Hiw can this be solved?
I'm not a POP expert by any means, but I think you're going to have to
either use TOP or RETR to get the information you want, in order to
decide if you want to delete the message. In REBOL, you open the
mailbox, import each message, analyze it, and remove it if desired.
Using TOP might work as well. Maybe Graham, Phil, or another mail
expert can be more helpful.
-- Gregg