Hi Tom,

The short answer is, you use WRITE/APPEND instead of PRINT.

Here is the function I use to download the mail. It's really
primitive, but might give you some more ideas.

readmail: func [
    {read mail from POP server}
    /bak "save to a backup file with all header info"
    /local mail url message bakfile emfile mail-directory
][
    if not mail-directory: select directories 'mail [
        mail-directory: %""
    ]
    prin "Password: "
    url: rejoin [
        pop://
        system/user/email/user
        ":" input/hide                ; get the user's the password
        "@" system/schemes/pop/host
    ]
    bakfile: join mail-directory %email.bak
    emfile:  join mail-directory %email.em
    mail: open url
    while [ not tail? mail ] [
        message: first mail
        if bak [
            write/append bakfile rejoin [
                "^(page)^/"
                message
            ]
        ]
        message: import-email message
        write/append emfile rejoin [
            "^(page)" message/subject
            "^/" message/from
            "^/" message/date
            either in message 'x-mailer [join "^/" message/x-mailer][""]
            either all [in message 'cc message/cc] [join "^/" message/cc][""]
            "^/^/" message/content
            "^/"
        ]
        remove mail
    ]
    close mail
]


Cheers,
Eric

Reply via email to