Title: 'SendGrid' Email API Client
Version: 0.2.0
Description: Simple 'SendGrid' Email API client for creating and sending emails. For more information, visit the official 'SendGrid' Email API documentation: https://sendgrid.com/en-us/solutions/email-api.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
URL: https://github.com/botan/sg, https://botan.github.io/sg/
BugReports: https://github.com/botan/sg/issues
Depends: R (≥ 4.2)
Imports: base64enc, httr2, mime, rlang
NeedsCompilation: no
Packaged: 2024-09-27 17:34:47 UTC; botan
Author: Botan Ağın [aut, cre]
Maintainer: Botan Ağın <aginbotan@gmail.com>
Repository: CRAN
Date/Publication: 2024-09-29 00:00:02 UTC

Check if a string is in a valid email format

Description

Check if a string is in a valid email format

Usage

is_email_address(email)

Arguments

email

A character string.

Value

A logical value.


Create and send MIME formatted message objects

Description

Methods for creating and sending MIME messages.

Usage

sg_mime()

sg_from(x, email)

sg_to(x, ...)

sg_cc(x, ...)

sg_bcc(x, ...)

sg_subject(x, subject)

sg_body(x, body, type = "text/html")

sg_attachments(x, ...)

sg_send(x, api_key = Sys.getenv("SENDGRID_API_KEY"))

Arguments

x

A MIME object.

email

The sender's email address.

...

One or more email addresses.

subject

The email subject.

body

The body content of the email.

type

The content type (e.g., "text/plain")

api_key

SendGrid API key. Defaults to the environment variable SENDGRID_API_KEY if not provided.

Value

A MIME object.

Examples

## Not run: 
  sg_mime() |>
    sg_from("sender@example.com") |>
    sg_to("recipient1@example.com", "recipient2@example.com") |>
    sg_cc("cc1@example.com", "cc2@example.com") |>
    sg_bcc("bcc1@example.com", "bcc2@example.com") |>
    sg_subject("This is the subject") |>
    sg_body("Hello from sg!") |>
    sg_attachments("path/to/file1.csv", "path/to/file2.pdf") |>
    sg_send()

## End(Not run)