[1/2] from: balayo:mindspring at: 14-Feb-2001 6:53
hey guys, I'd like to filter my mail, according to address, as it comes off of the server. Jeff posted this script some time ago, but it's for use with something like sendmail or exim, and I've never been able to get it working. How easy would it be to convert this thing to pop? ; #!/usr/local/bin/rebol -qws ; REBOL [ ; Title: "Mail filter" ; ] ; ; stdin: copy system/ports/input ; message: import-email stdin ; ; foreach [item file][ ; "[list--rebol--com]" %rebol-box ; "[docbook--lists--oasis-open--org]" %doc-box ; ][ ; if find item message/to [ ; write/append file stdin ; exit ; ] ; ] ; write/append %default-box stdin ; ; quit Thanks... -- Loving every minute of it. -tom
[2/2] from: jeff::rebol::net at: 14-Feb-2001 14:21
> hey guys, > > I'd like to filter my mail, according to address, as it comes > off of the server. Jeff posted this script some time ago, but > it's for use with something like sendmail or exim, and I've > never been able to get it working. How easy would it be to > convert this thing to pop?
How about: #!/usr/local/bin/rebol -q REBOL [Title: "POP FROM FILTER"] me: "account" pass: ask/hide "Password? " server: "pop.server.dom" pop: open rejoin [pop:// me ":" pass "@" server] forall pop [ message: import-email mesg: first pop prin [index? pop message/from tab message/subject "->"] foreach [item file][ [rebol-list--rebol--com] %rebol-box [docbook--lists--oasis-open--org] %doc-box ][ if find item message/to [ write/append probe file mesg break ] ] ] close pop It will print out the from and subject of the message, and the file it ends up sticking it in. I did not test the above, but it looks correct to me. :) -jeff