Skip to content

Latest commit

 

History

History
106 lines (76 loc) · 2.97 KB

README.md

File metadata and controls

106 lines (76 loc) · 2.97 KB

emayili

Travis-CI build status Codecov test coverage Lifecycle: experimental CRAN

emayili is a package for sending emails from R. The design goals are:

  • works on all manner of SMTP servers and
  • has minimal dependencies (or dependencies which are easily satisfied).

The package name is an adaption of the Zulu word for email, imeyili.

Installation

Simply install from GitHub.

remotes::install_github("datawookie/emayili")

Usage

First create a message object.

library(emayili)
library(magrittr)

email <- envelope()

Add addresses for the sender and recipient.

email <- email %>%
  from("[email protected]") %>%
  to("[email protected]") %>%
  cc("[email protected]")

There are also bcc() and reply() functions for setting the Bcc and Reply-To fields.

Add a subject.

email <- email %>% subject("This is a plain text message!")

Add a body.

email <- email %>% body("Hello!")

Add an attachment.

email <- email %>% attachment("image.jpg")

Create a SMTP server object and send the message.

smtp <- server(host = "smtp.gmail.com",
               port = 465,
               username = "[email protected]",
               password = "bd40ef6d4a9413de9c1318a65cbae5d7")
smtp(email, verbose = TRUE)

Using STARTTLS

If you’re trying to send email with a host that uses the STARTTLS security protocol (like Google Mail, Yahoo! or AOL), then it will most probably be blocked due to insufficient security. In order to circumvent this, you can grant access to less secure apps. See the links below for specifics:

Similar Packages

There is a selection of other R packages which also send emails: