Package 'sg'

Title: 'SendGrid' Email API Client
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>.
Authors: Botan Ağın [aut, cre]
Maintainer: Botan Ağın <[email protected]>
License: MIT + file LICENSE
Version: 0.2.0.9000
Built: 2024-09-29 12:22:02 UTC
Source: https://github.com/botan/sg

Help Index


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("[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()

## End(Not run)