Rebol 编程/import-email
外观
< Rebol 编程
IMPORT-EMAIL data /multiple parent
从电子邮件消息构建电子邮件对象。
IMPORT-EMAIL 是一个函数值。
- data -- 电子邮件消息(类型:字符串)
- /multiple -- 收集标头中的多个字段
- parent -- (类型:对象)
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 ]