The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Title: Mail Sender Using 'Sendgrid' Service
Version: 0.6.1
Description: Send email using 'Sendgrid' https://sendgrid.com/ mail API(v3) https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/authentication.
License: MIT + file LICENSE
URL: https://github.com/mrchypark/sendgridr
BugReports: https://github.com/mrchypark/sendgridr/issues
Imports: magrittr, httr, jsonlite, usethis, cli, base64enc, emayili (≥ 0.7), keyring
Encoding: UTF-8
RoxygenNote: 7.2.1
Depends: R (≥ 3.4)
Suggests: covr, testthat
NeedsCompilation: no
Packaged: 2022-11-06 18:51:23 UTC; mrchypark
Author: Chanyub Park ORCID iD [aut, cre]
Maintainer: Chanyub Park <mrchypark@gmail.com>
Repository: CRAN
Date/Publication: 2022-11-06 19:00:02 UTC

sendgridr: Mail Sender Using 'Sendgrid' Service

Description

logo

Send email using 'Sendgrid' https://sendgrid.com/ mail API(v3) https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/authentication.

Author(s)

Maintainer: Chanyub Park mrchypark@gmail.com (ORCID)

See Also

Useful links:


Pipe operator

Description

See magrittr::%>% for details.

Usage

lhs %>% rhs

Arguments

lhs

A value or the magrittr placeholder.

rhs

A function call using the magrittr semantics.

Value

The result of calling rhs(lhs).


set address to sg_mail class

Description

to(), cc(), bcc() is for set email address to sg_mail class

Usage

to(sg_mail, email, name = "")

cc(sg_mail, email, name = "")

bcc(sg_mail, email, name = "")

Arguments

sg_mail

(required)mail object from package

email

(required)email address

name

(optional)name for email address.

Value

sg_mail class with mail address.

Examples

mail() %>%
  to("mrchypark@gmail.com")

mail() %>%
  cc("mrchypark@gmail.com")

mail() %>%
  bcc("mrchypark@gmail.com")

attachments

Description

attachments

Usage

attachments(sg_mail, path, name, content_id)

Arguments

sg_mail

(required)mail object from package

path

(required)file path to attach

name

file name. default is path's file name

content_id

content id. default is Null.

Value

sg_mail class with attachments.

Examples

path <- system.file("extdata", "test.Rmd", package = "sendgridr")
mail() %>%
  attachments(path)


Check API key for auth.

Description

Check API key for auth.

Usage

auth_check()

Value

TRUE/FALSE check work fine return TRUE.


Set API key for auth.

Description

Set API key for auth.

Usage

auth_set(apikey)

Arguments

apikey

sendgrid api key. If key has value, just use as api key. If without param, function call interactive prompt input.

Value

None


body

Description

body

Usage

body(sg_mail, body, type = "text/html")

Arguments

sg_mail

(required)mail object from package

body

(required)mail content html support.

type

content type. text/html is default.

Value

sg_mail class with body content.

Examples

mail() %>%
  body("mrchypark@gmail.com")

Add dynamic template

Description

Create dynamic templates at https://mc.sendgrid.com/dynamic-templates.

Usage

dynamic_template(sg_mail, template_id, template_data, force = FALSE)

Arguments

sg_mail

(required) mail object from package

template_id

(required) template_id start "d-" and 32-length only digit and lower case alphabet like "d-4ad23ad40a0e47d0a0232b85f24ca5c2"

template_data

A key-value list for template data. (See https://docs.sendgrid.com/ui/sending-email/how-to-send-an-email-with-dynamic-templates)

force

pass template_id validation. default is FALSE.

Value

sg_mail class with dynamic template

Examples

mail() %>%
  dynamic_template("d-4ad23ad40a0e47d0a0232b85f24ca5c2", list(first_name = "Amanda", link = "foo"))

mail() %>%
  dynamic_template(template_id = "foo",
    template_data = list(first_name = "Amanda", link = "foo"),
    force = TRUE)

Add dynamic template data

Description

template_id must be included for this data to be applied.

Usage

dynamic_template_data(sg_mail, data)

Arguments

sg_mail

(required) mail object from package

data

A key-value list for template data. (See https://docs.sendgrid.com/ui/sending-email/how-to-send-an-email-with-dynamic-templates)

Value

sg_mail class with template data for dynamic transactional templates

Examples

data_lst <-
  list(
    first_name = "Amanda",
    link = "foo"
  )

mail() %>%
  template_id("d-4ad23ad40a0e47d0a0232b85f24ca5c2")%>%
  dynamic_template_data(data_lst)

Embeding Rmd on body with images.

Description

Embeding Rmd on body with images.

Usage

embed_rmd(sg_mail, input, ...)

Arguments

sg_mail

(required) mail object from package

input

(required) input file path to render for email.

...

extra params pass to emayili::render() function.

Examples


path <- system.file("extdata", "test.Rmd", package = "sendgridr")
mail() %>%
 embed_rmd(path)


from

Description

from

Usage

from(sg_mail, email, name = "")

Arguments

sg_mail

(required)mail object from package

email

(required)email address

name

name for email address

Value

sg_mail class with from mail address.

Examples

mail() %>%
  from("mrchypark@gmail.com")

Set mail class for Sendgrid

Description

New mail class for sendgrid.

Usage

mail()

Value

sg_mail class.

Examples

mail()

Print for sg_mail class

Description

Print for sg_mail class

Usage

## S3 method for class 'sg_mail'
print(x, ...)

Arguments

x

sg_mail class object

...

pass for default print. But not use in sg_mail class.


send mail

Description

Send mail with mail content.

Usage

send(mail)

Arguments

mail

mail object

Value

list if success, success message. and error, please check https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/authentication.

Examples

## Not run: 

data_lst <-
  list(
    total = "$239.85",
    name = "Sample Name"
  )

mail() %>%
  from("example1@mail.com", "example name for display") %>%
  to("example2@mail.com", "example name for display 2") %>%
  dynamic_template_data(data_lst) %>%
  template_id(template_id) %>%
  subject("test mail title") %>%
  body("hello world!") %>%
  ## attachments is optional
  attachments("report.html") %>%
  send()

## End(Not run)

subject

Description

subject

Usage

subject(sg_mail, subject)

Arguments

sg_mail

(required)mail object from package

subject

(required)mail subject

Value

sg_mail class with subject.

Examples

mail() %>%
  subject("mrchypark@gmail.com")

template id

Description

Create dynamic templates at https://mc.sendgrid.com/dynamic-templates

Usage

template_id(sg_mail, template_id, force = FALSE)

Arguments

sg_mail

(required) mail object from package

template_id

(required) template_id start "d-" and 32-length only digit and lower case alphabet like "d-4ad23ad40a0e47d0a0232b85f24ca5c2"

force

pass template_id validation. default is FALSE.

Value

sg_mail class with template id.

Examples


mail()%>%
  template_id("d-4ad23ad40a0e47d0a0232b85f24ca5c2")

mail() %>%
  template_id("foo", force = TRUE)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.