prepare_email: Prepare an outgoing Outlook email

Description Usage Arguments Details

Description

Prepare an email in Microsoft Outlook, either sending the email immediately or causing the window to appear on the user's screen. This function prepares emails with DCOM, which is only available in Windows, and is exposed to R through the RDCOMClient package. Attachments are supported, as well as "embeddings"—a vector of data frames, tibbles or ggplot objects that are embedded into the body of the outgoing email. It is recommended that Microsoft Outlook be open in the background before using this function.

Usage

1
2
3
4
prepare_email(embeddings = NULL, body = "", to = "", cc = "",
  subject = "", attachments = NULL, css = "", send = FALSE,
  max_image_height = 800, max_image_width = 800, data_file_format = "csv",
  col_names = TRUE, image_file_format = "png")

Arguments

embeddings

An optional list of all objects to be embedded into the email body, if possible. Ggplots, data frames, tibbles, and file paths corresponding to known image formats (png, jpg, bmp, gif, tiff, or webp) will be embedded into the email body. Other files, as long as they exist, will be attached instead. ggplots will be converted to images and data frames/tibbles will be converted to html.

body

A html body for the email. This does not need to be enclosed in paragraph tags. Defaults to an empty string.

to

A string containing the email addresses, separated by semicolons, which are to receive the email. Defaults to an empty string.

cc

A string containing the email addresses, separated by semicolons, which are to be CC'd in on the email. Defaults to an empty string.

subject

A string containing the subject line of the email. Defaults to an empty string.

attachments

A ggplot, data frame, tibble, or file path which will be attached to the email (converting to a file if necessary), or a vector containing any combination of these things. ggplots will be converted to images and data frames/tibbles will be converted to delimited files. If providing a list of ggplot or data frames/tibbles, it it best to provide a named list. Otherwise, the attachments will be named attachment_1, attachment_2, etc.

css

An optional string of CSS that will modify the HTML body of the email. Note that only some CSS affects Outlook emails.

send

A Boolean value which, if set to TRUE, will send the email immediately. If set to FALSE, will display the email on the user's screen, but not send. Defaults to FALSE.

max_image_height

The maximum height of any embedded image. Images will be scaled down, if necessary. For png, jpg, or bmp files, the aspect ratio of the image will be preserved when scaling.

max_image_width

The maximum width of any embedded image. Images will be scaled down, if necessary. For png, jpg, or bmp files, the aspect ratio of the image will be preserved when scaling.

data_file_format

When attaching data frames/tibbles, the object will be saved as a file of this format before attaching. Possible options are "csv", "tsv", or "xlsx". Defaults to "csv".

col_names

Determines if column names (headers) are to be included when saving data frames/tibbles as files to be attached. Defaults to TRUE.

image_file_format

When attaching ggplots, the object will be saved as a file of this format before attaching. It is recommended to use either "png" or "jpeg". Defaults to "png".

When

attaching data frames/tibbles, the object will be saved as a file of this format before attaching. Possible options are "csv", "tsv", or "xlsx".

Details

No argument is mandatory; running prepare_email() will cause a blank composing window to appear. CSS can be entered with the css argument, but note that most CSS is disabled by Microsoft Outlook.


mdneuzerling/RDCOMOutlook documentation built on May 21, 2019, 12:21 p.m.