REBOL [
    Title: "Email Viewer (as web page)"
    File:  %mailview.r
    Date:  10-Sep-1999
    Purpose: {
        This example displays all of your pending email
        as an HTML web page. (But does not remove it.)
    }
    Note: {
        Does not remove the mail from the server.
        See the popspec.r file for examples of how
        to setup your mailbox connection.
    }
    Category: [email markup net 2] 
]

html: make string! 10000  ; where new page is stored
emit: func [data] [append html reduce data]

inbox: open load %popspec.r  ;file contains POP email box info

emit [
    <html><body>
    <center><H3>"Mailbox Summary for " now/date " " now/time </H3>
    length? inbox " message(s)" </center><p>
    <table border="1" width="100%">
]

forall inbox [
    mail: import-email first inbox
    emit [
        <tr></tr>
        <tr><td>"From:"</td><td><b> first mail/from </b></td></tr>
        <tr><td>"Subject:"</td><td><b> mail/subject </b></td></tr>
        <tr><td>"Length:"</td><td> length? mail/content </td></tr>
        <tr><td></td><td><pre> mail/content </pre></td></tr>
    ]
]

emit [</table><p></body></html>]
close inbox
write %inbox.html html