Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrchypark/sendgridr

Mail Sender Using SendGrid mail API
https://github.com/mrchypark/sendgridr

hacktoberfest hacktoberfest2021 mail mailer package r sendgrid

Last synced: 27 days ago
JSON representation

Mail Sender Using SendGrid mail API

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(sendgridr)
```

# sendgridr

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/mrchypark/sendgridr/workflows/R-CMD-check/badge.svg)](https://github.com/mrchypark/sendgridr/actions)
[![send-test](https://github.com/mrchypark/sendgridr/actions/workflows/send-test.yaml/badge.svg)](https://github.com/mrchypark/sendgridr/actions/workflows/send-test.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/sendgridr)](https://CRAN.R-project.org/package=sendgridr)
[![runiverse-name](https://mrchypark.r-universe.dev/badges/:name)](https://mrchypark.r-universe.dev/)
[![runiverse-package](https://mrchypark.r-universe.dev/badges/sendgridr)](https://mrchypark.r-universe.dev/packages)
[![metacran downloads](https://cranlogs.r-pkg.org/badges/sendgridr)](https://cran.r-project.org/package=sendgridr)
[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/sendgridr)](https://CRAN.R-project.org/package=sendgridr)

The goal of sendgridr is to mail using r with sendgrid service that provides free 100 mail per day forever.

## Installation

```
# CRAN version
install.packages("sendgridr")

# Dev version
install.packages("sendgridr", repos = "https://mrchypark.r-universe.dev")
```

## Set API key for authentication

You can set api key using `auth_set()` function.
Also `auth_check()` function check api key works.

```
auth_check()
auth_set()
```

## Send mail

### Example code

Please replace your conditions.

```
mail() |>
from("[email protected]", "example name for display") |>
to("[email protected]", "example name for display 2") |>
subject("test mail title") |>
body("hello world!") |>
## attachments is optional
attachments("report.html") |>
send()
```

### sg_mail class

`mail()` function create sg_mail class object and also list.
sg_mail class only has print method.

```{r}
sendproject1 <- mail()
class(sendproject1)
sendproject1
```

to, from, subject, body are required. cc, bcc, attachments are optional.

### multi- setting using inline

to, cc, bcc, attachments functions are able to set multi values.

```{r}
library(sendgridr)
mail() |>
from("[email protected]", "[email protected]") |>
to("[email protected]", "1 exam") |>
to("[email protected]", "2 exam") |>
to("[email protected]", "3 exam") |>
subject("test mail title") |>
body("hello world!")
```

## Code of Conduct

Please note that the sendgridr project is released with a [Contributor Code of Conduct](https://mrchypark.github.io/sendgridr/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.