Learn R Programming

mRpostman (version 0.3.1)

string: Criteria Helper Functions for Custom Search

Description

Criteria helper functions to be combined inside a operator helper function as a custom request in custom_search.

Usage

string(section_or_field, string, negate = FALSE)

Arguments

section_or_field

A mandatory character string specifying in which messages's Section or Header Field to search for the provided string. For some available options, see section_or_field_options.

string

A character string specifying the word or expression to search for in messages.

negate

If TRUE, negates the search and seeks for "NOT search_criterion". Default is FALSE.

Value

A search string to be used as a custom_request parameter in custom_search function.

See Also

Other customsearch helper functions: AND, OR, before, flag, larger_than, older_than, on, sent_before, sent_on, sent_since, since, smaller_than, younger_than

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

# search
result <- imapconf %>%
    select_mailbox(mbox = "INBOX") %>%
    custom_search(custom_request =
                 OR(string(
                       section_or_field = "from", string = "allanvcq@gmail.com"),
                    string(
                       section_or_field = "from", string = "allanvcq@yahoo.com")
                   )
                 )
# searches for messages containing the string "allanvcq@gmail.com" OR
# "allanvcq@yahoo.com" in the "FROM" field.

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab