-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
60 lines (44 loc) · 1.4 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# sg
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/sg)](https://CRAN.R-project.org/package=sg)
<!-- badges: end -->
Simple SendGrid Email API client for sending emails with R.
## Installation
Install the released version of sg from CRAN:
``` r
install.packages("sg")
```
Or install the development version from GitHub with:
``` r
# install.packages("pak")
pak::pak("botan/sg")
```
## Authentication
Set your API key using the `SENDGRID_API_KEY` environment variable. The package will automatically detect and use it when sending emails.
## Usage
This is a basic example which shows you how to send an email:
```r
library(sg)
sg_mime() |>
sg_from("[email protected]") |>
sg_to("[email protected]", "[email protected]") |>
sg_cc("[email protected]", "[email protected]") |>
sg_bcc("[email protected]", "[email protected]") |>
sg_subject("This is the subject") |>
sg_body("Hello from sg!") |>
sg_attachments("path/to/file1.csv", "path/to/file2.pdf") |>
sg_send()
```