forked from datawookie/emayili
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
98 lines (67 loc) · 3.04 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
# emayili <img src="man/figures/emayili-hex.png" align="right" alt="" width="120" />
[![Travis-CI build status](https://travis-ci.org/datawookie/emayili.svg?branch=master)](https://travis-ci.org/datawookie/emayili)
[![Codecov test coverage](https://img.shields.io/codecov/c/github/datawookie/emayili.svg)](https://codecov.io/github/datawookie/emayili)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![CRAN](https://img.shields.io/cran/v/emayili.svg)](https://cran.r-project.org/web/packages/emayili/index.html)
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.
```{r eval=FALSE}
remotes::install_github("datawookie/emayili")
```
## Usage
First create a message object.
```{r eval=FALSE}
library(emayili)
library(magrittr)
email <- envelope()
```
Add addresses for the sender and recipient.
```{r eval=FALSE}
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.
```{r eval=FALSE}
email <- email %>% subject("This is a plain text message!")
```
Add a body.
```{r eval=FALSE}
email <- email %>% body("Hello!")
```
Add an attachment.
```{r eval=FALSE}
email <- email %>% attachment("image.jpg")
```
Create a SMTP server object and send the message.
```{r eval=FALSE}
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:
* [Google](https://myaccount.google.com/security) ([details](https://support.google.com/accounts/answer/6010255))
* [Yahoo!](https://login.yahoo.com/account/security) and
* [AOL](https://login.aol.com/account/security).
## Similar Packages
There is a selection of other R packages which also send emails:
- [blastula](https://cran.r-project.org/web/packages/blastula/index.html)
- [blatr](https://cran.r-project.org/web/packages/blatr/index.html) (Windows)
- [gmailr](https://cran.r-project.org/web/packages/gmailr/index.html)
- [mail](https://cran.r-project.org/web/packages/mail/index.html)
- [mailR](https://cran.r-project.org/web/packages/mailR/index.html)
- [sendmailR](https://cran.r-project.org/web/packages/sendmailR/index.html)
- [ponyexpress](https://github.com/ropenscilabs/ponyexpress)