All Projects → datawookie → Emayili

datawookie / Emayili

An R package for sending email messages.

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Emayili

Waiter
🕰️ Loading screens for Shiny
Stars: ✭ 325 (+351.39%)
Mutual labels:  hacktoberfest, rstats
Climate Change Data
🌍 A curated list of APIs, open data and ML/AI projects on climate change
Stars: ✭ 195 (+170.83%)
Mutual labels:  hacktoberfest, rstats
Cicerone
🏛️ Give tours of your Shiny apps
Stars: ✭ 131 (+81.94%)
Mutual labels:  hacktoberfest, rstats
Echarts4r
🐳 ECharts 5 for R
Stars: ✭ 378 (+425%)
Mutual labels:  hacktoberfest, rstats
Opentogethertube
Watch videos with your friends. The spiritual successor to TogetherTube, preserving the spirit of it's simple to use interface, while improving it's look, feel, and reliability.
Stars: ✭ 72 (+0%)
Mutual labels:  hacktoberfest
Laravel Disqus
A simple Disqus platform integration with Laravel.
Stars: ✭ 71 (-1.39%)
Mutual labels:  hacktoberfest
Hacktoberfest
Contribute to this repository to participate in hacktoberfest
Stars: ✭ 71 (-1.39%)
Mutual labels:  hacktoberfest
Chef Splunk
Development repository for the chef-splunk cookbook
Stars: ✭ 70 (-2.78%)
Mutual labels:  hacktoberfest
Pagination
Paginate record sets, not tied in directly to a database.
Stars: ✭ 72 (+0%)
Mutual labels:  hacktoberfest
Church Calendar Api
API providing Roman Catholic church calendar data for your apps
Stars: ✭ 72 (+0%)
Mutual labels:  hacktoberfest
Micropipenv
A lightweight wrapper for pip to support requirements.txt, Pipenv and Poetry lock files or converting them to pip-tools compatible output. Designed for containerized Python applications but not limited to them.
Stars: ✭ 72 (+0%)
Mutual labels:  hacktoberfest
Made In India
🇮🇳 A list of neat projects made in India.
Stars: ✭ 70 (-2.78%)
Mutual labels:  hacktoberfest
Moviedb Promise
Interact with themoviedb.org's api with Node... now in TypeScript!
Stars: ✭ 72 (+0%)
Mutual labels:  hacktoberfest
Wassm
Web framework for x86_64 nasm
Stars: ✭ 71 (-1.39%)
Mutual labels:  hacktoberfest
Gsodr
Global Surface Summary of the Day ('GSOD') Weather Data Client for R
Stars: ✭ 72 (+0%)
Mutual labels:  rstats
Hacktoberfest 2020 Fizzbuzz
🎃 Submit creative/abstract FizzBuzz solutions in any language you want!
Stars: ✭ 71 (-1.39%)
Mutual labels:  hacktoberfest
Dockerkit
Control your Docker Containers with HomeKit
Stars: ✭ 72 (+0%)
Mutual labels:  hacktoberfest
Loadingshimmer
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.
Stars: ✭ 1,180 (+1538.89%)
Mutual labels:  hacktoberfest
Interview Prep
Everything you need to know to get the job
Stars: ✭ 69 (-4.17%)
Mutual labels:  hacktoberfest
Hacktoberfest2020
Contribute for hacktoberfest 2020
Stars: ✭ 72 (+0%)
Mutual labels:  hacktoberfest

emayili

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

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

Get the stable version from CRAN.

install.packages("emayili")

Or grab it directly from GitHub.

# Install from the master branch.
remotes::install_github("datawookie/emayili")
# Install from the development branch.
remotes::install_github("datawookie/emayili", ref = "dev")

Usage

First create a message object.

library(emayili)
library(magrittr)

email <- envelope()

Creating a Message

The message has class envelope.

class(email)
[1] "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 text body. You can use html() to add an HTML body.

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

Add an attachment.

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

You can also create the message in a single command:

email <- envelope(
  to = "[email protected]",
  from = "[email protected]",
  subject = "This is a plain text message!",
  text = "Hello!"
)

Simply printing a message displays the header information.

email
Date:         Sat, 06 Mar 2021 06:41:03 GMT
From:         [email protected]
To:           [email protected]
Cc:           [email protected]
Subject:      This is a plain text message!
X-Mailer:     {emayili}-0.4.7

You can identify emails which have been sent using {emayili} by the presence of an X-Mailer header which includes both the package name and version.

If you want to see the complete MIME object, just convert to a string.

as.character(email)

Adding an Inline Image

Adding an inline image to an HTML message is possible. There are two ways to achieve this.

1. Base64 Encoding

First you’ll need to Base64 encode the image.

img_base64 <- base64enc::base64encode("image.jpg")

Then create the HTML message body.

html_body <- sprintf('<html><body><img src="data:image/jpeg;base64,%s"></body></html>', img_base64)

And finally add it to the email.

email <- envelope() %>% html(html_body)

Note: It’s important that you specify the appropriate media type (image/jpeg for JPEG and image/png for PNG).

2. Using a CID

Unfortunately some mail clients (like Gmail) will not display Base64 encoded images. In this case using a CID is a working alternative.

First create the message body which references an image by CID.

html_body <- '<html><body><img src="cid:image"></body></html>'

Then attach the image and specify the cid argument.

email <- envelope() %>%
  html(html_body) %>%
  attachment(path = "image.jpg", cid = "image")

Sending a Message

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)

To see the guts of the message as passed to the SMTP server:

print(email, details = 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:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].