Learn R Programming

mRpostman (version 0.3.1)

fetch_full_msg: Fetch Full Messages

Description

Fetch all the sections and fields of one or more messages.

Usage

fetch_full_msg(imapconf, msg_id, by = "MSN", peek = TRUE,
  partial = NULL, write_to_disk = FALSE, keep_in_mem = TRUE,
  retries = 2)

Arguments

imapconf

An object of class imapconf generated with configure_imap and with a mbox item added after a mailbox selection with select_mailbox.

msg_id

A numeric vetor containing one or more messages ids.

by

Which id (MSN or UID) to use when searching for messages. "MSN" or message squence number is a message's relative position to the older message in the mailbox. It may change after deleting or moving messages. For instance, if a message is deleted, message sequence numbers are reordered to fill the gap. "UID" or unique identifier is always the same during the life cycle of a message. Default is "MSN".

peek

If TRUE, it does not mark messages as "read" after fetching. Default is TRUE.

partial

NULL or a character string with format "startchar.endchar" indicating the size (in characters) of a message slice to fetch. Default is NULL, which fetchs the full specified content.

write_to_disk

If TRUE writes fetch content of each message to the disk as a text file in the working directory. Default is FALSE.

keep_in_mem

If TRUE keeps a copy of fetch results as an list in the R session when write_to_disk = TRUE. Default is TRUE. It can only be set FALSE when write_to_disk = TRUE.

retries

Number of attempts to connect and execute the command. Default is 2.

Value

A list or/and text files containing the fetch results.

See Also

Other fetch: fetch_msg_header, fetch_msg_metadata, fetch_msg_text

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# configure IMAP
library(mRpostman)
imapconf <- configure_imap(url="imaps://your.imap.server.com",
                           username="your_username",
                           password=rstudioapi::askForPassword()
                          )

# fetching
results <- imapconf %>%
    select_mailbox(mbox = "TAM") %>%
    search_before(date_char = "10-may-2012", by = "UID") %$% #exposition pipe - two argg
    fetch_full_msg(imapconf = imapconf,
                   msg_id = msg_id,
                   by="UID", write_to_disk = TRUE,
                   keep_in_mem = FALSE,
                   partial = "0.789")

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab