Rebol Programming/import-email
Tools
General
Sister projects
In other projects
IMPORT-EMAIL data /multiple parent
Constructs an email object from an email message.
IMPORT-EMAIL is a function value.
import-email: func [ "Constructs an email object from an email message." data [string!] "The email message" /multiple "Collect multiple fields in header" parent [object!] /local content frm][ data: parse-header either multiple [parent] [system/standard/email] content: data frm: func [val /local res] [ either block? val [ either empty? val [ copy "" ] [ res: copy first val foreach addlst next val [ insert insert tail res ", " addlst ] res ] ] [ val ] ] data/date: parse-header-date either block? data/date [first data/date] [data/date] data/from: parse-email-addrs frm data/from data/to: parse-email-addrs frm data/to all [multiple data/cc: parse-email-addrs frm data/cc] all [multiple data/bcc: parse-email-addrs frm data/bcc] data/reply-to: parse-email-addrs frm data/reply-to data/content: any [data/content tail content] data]