parse_envelope: Parse an IMAP ENVELOPE into a one-row data frame

View source: R/imap-parse-list.R

parse_envelopeR Documentation

Parse an IMAP ENVELOPE into a one-row data frame

Description

Reads the ENVELOPE (...) structure of a FETCH response (RFC 3501, section 7.4.2), as returned by ImapCon$fetch_metadata(attribute = "ENVELOPE"), into analysis-ready columns. Address lists are formatted as Name <mailbox@host> and joined with commas; RFC 2047 encoded words in names and subjects are decoded.

Usage

parse_envelope(x)

Arguments

x

A character string with a FETCH response (or the part of it starting at ENVELOPE).

Value

A one-row data.frame with columns date, subject, from, sender, reply_to, to, cc, bcc, in_reply_to, and message_id (NA where the message has no value).

Examples

x <- paste0('ENVELOPE ("Mon, 7 May 2001 08:41:00 -0700" "A resume" ',
            '(("Vince Kaminski" NIL "vince.kaminski" "enron.com")) NIL NIL ',
            '((NIL NIL "stephen.stock" "enron.com")) NIL NIL NIL "<id@x>")')
parse_envelope(x)

mRpostman documentation built on Nov. 6, 2026, 9:06 a.m.