Learn R Programming

mRpostman (version 0.3.1)

delete_msg: Delete Messages

Description

Deletes messages from a mailbox.

Usage

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

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

# deleting based on search results
result1 <- imapconf %>%
    select_mailbox(mbox = "TAM") %>%
    search_before(date_char = "10-may-2012", by = "UID") %$% #modified pipe operator - pass two argg
    delete_msg(imapconf = imapconf, msg_id = msg_id)


# deleting a specific msg_id without a previous search
result2 <- imapconf %>%
    select_mailbox(mbox = "INBOX") %>%
    delete_msg(msg_id = 66128)

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab