Learn R Programming

mRpostman (version 0.3.1)

copy_msg: Copy Messages

Description

Copies messages form a mailbox to another.

Usage

copy_msg(imapconf, msg_id, by = "MSN", to_mbox, reselect_mbox = FALSE,
  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".

to_mbox

A character string specifying the mailbox to which messages will be copied to.

reselect_mbox

If TRUE, calls select_mailbox(mbox = to_mbox) before returning the output. Default is FALSE for moving and copying operations, whereas it is TRUE for renaming mailboxes.

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, count_msgs, delete_msg, expunge, get_max_id, get_min_id, move_msg, remove_flags, replace_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()
                          )

# copy search results from "Sent" to "INBOX"
results <- imapconf %>%
    select_mailbox(mbox = "Sent") %>%
    search_before(date_char = "10-may-2012") %$% #exposition pipe operator - pass two argg
    copy_msg(imapconf = imapconf, msg_id = msg_id, to_mbox = "INBOX")

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab