Learn R Programming

mRpostman (version 0.3.1)

replace_flags: Replace Flag(s) in Messages

Description

Replaces all flags in messages by one or more flags.

Usage

replace_flags(imapconf, msg_id, by = "MSN", flags_to_set, 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".

flags_to_set

A character vector containing one ore more flag names to add to or replace in the specified message ids.

retries

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

Value

An (invisible) list of length 2 containing the imapconf object and the previously inputed message ids (parameter msg_id).

See Also

Other miscellaneous: add_flags, copy_msg, count_msgs, delete_msg, expunge, get_max_id, get_min_id, move_msg, remove_flags

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()
                          )

result1 <- imapconf %>%
    select_mailbox(mbox = "TAM") %>%
    search_before(date_char = "10-may-2012", by = "UID") %$% #exposition pipe - two argg
    replace_flags(imapconf = imapconf, msg_id = msg_id, flags_to_set = c("SEEN", "DRAFT"))

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab