
Populate a Mailbox with the Synthetic Sandbox Corpus
Source:R/populate-sandbox.R
populate_sandbox.RdStores the deterministic corpus generated by
sandbox_corpus in a mailbox, using the package's own IMAP
operations: each message is uploaded with APPEND
(ImapCon$append_msg()), a secondary folder is created with
CREATE, and flags are set with STORE. It is meant to be run
against the disposable local Docker IMAP server shipped in
system.file("docker", package = "mRpostman") — see the
"A reproducible IMAP sandbox with Docker" vignette — but works
against any IMAP account (mind your provider's rate limits).
Arguments
- con
An
ImapConobject, as returned byconfigure_imap.- n
Number of messages to append to INBOX. Default is
200.- seed
An integer used as the RNG seed for
sandbox_corpus. Default is3501, after RFC 3501.- extra_folder
A string with the name of a secondary folder to be created and populated with every 10th message (for folder, COPY, and MOVE demonstrations), or
NULLto skip it. Default is"ProjectAtlas".- mute
A
logical. IfFALSE, prints progress and a final summary. Default isFALSE.
Value
Invisibly, the info data.frame of the generated corpus (see
sandbox_corpus).
Details
ImapCon$append_msg() stores the messages without flags on
libcurl >= 8.13, but earlier libcurl versions hardcode \Seen in
APPEND, so populate_sandbox() sets the planned
\Seen state explicitly in both directions after the upload. APPEND also stores the current time as the internal date
of every message, which is why the date searches below use the
header-based SENT* variants.
See also
Other sandbox:
enron_sandbox(),
ingest_maildir(),
sandbox_corpus()
Examples
if (FALSE) { # \dontrun{
# against the local Docker sandbox (see the vignette):
con <- configure_imap(url = "imap://localhost:1430",
username = "testuser",
password = "sandbox",
use_ssl = FALSE)
info <- populate_sandbox(con, n = 200)
} # }