mail help, revisited

here is ye olde modified mailboxsave.r.  It doesn't work as it is--
see any glaring mistakes (especially in the while loop?)

thanks,
-tom

#!/usr/local/bin/rebol -cs

REBOL [
    Title: "Save to Mailbox File"
    File:  %rebmutt.r
    Date:  10-Sep-1999
    Purpose: {
        This example reads email and appends it to a standard
        mailbox file (which can be read by most email apps).
    }
    Note: {
        Set the remove-mail flag true if you want to delete
        the email from your server as it is saved.
            }
]

;change-dir %/home/thisdir/thatdir

remove-mail: false


days: [Mon Tue Wed Thu Fri Sat Sun]
months: [Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec]
pad: [#"0" ""]
spc: #" "


inbox: open pop:pop.pop.com
print [length? inbox "messages"]
when: now

while [not tail? inbox] [
    mail: import-email message: first inbox
 if [EMAIL PROTECTED] = mail/to [file: %rebol.tml]
 if [EMAIL PROTECTED] = mail/to [file: %me.tml]
 write/append file rejoin [
        "From " mail/from spc
        pick days when/weekday spc
        pick months when/month spc
        pick pad when/day < 10  when/day spc
        pick pad when/time < 10:00  when/time spc
        when/year
        newline first inbox newline
    ]
    either remove-mail [remove inbox][inbox: next inbox]
]

close inbox

Reply via email to