The goal of outlookMailer is to create an R interface between Microsoft Outlook and R, to compose messages from R using Outlook’s native window.
It works only on Windows.

Installation

Requirements

The package requires access to Windows DCOM objects, provided by RDCOMClient.
It is no longer on CRAN, but can be installed from GitHub:

remotes::install_github('omegahat/RDCOMClient')

The package

The package is not on CRAN, install the developer version from here:

remotes::install_github('lgaborini/outlookMailer')

Manual

Here (built with pkgdown📦)

Example

The package wraps the COM interface to Microsoft Outlook with user-friendly R functions.

One retrieves/sets properties with [[ and ]] accessors.
One calls methods with the $ accessor.

Most functions are pipe-friendly:

connect_outlook() %>% 
  create_draft(body_plain = 'Test') %>% 
  close_draft(save = TRUE) %>%
  disconnect_outlook()

Attachments

Multiple attachments can be supplied as a vector of paths.

msg <- create_draft(con, attachments = c('foo.txt', 'foo2.txt'))

Messages saved as files

Messages saved as .msg or .eml can be opened and modified:

con <- connect_outlook()

msg <- open_msg(con, path_msg = 'sample.msg', show_message = TRUE)

COM utilities

The package provides a function check if a COM object has a property:

TODO

  • Fix the signature (HTML/plain text conversion)
  • Save and discard messages
  • Make it pipe-friendly (e.g. set_from, set_body, …)
  • Improve robustness to Windows calls
  • Re-implement has_COM_method
  • Move to S3 objects