~mna/tulip

The tulip.pkg.sendgrid module exports the sendgrid package.

#Configuration

  • from: string = default sender email
  • api_key: string = sendgrid API key

#API Extensions

Registering this package provides the following method and field extensions.

#ok, err = App:email(t)

Send an email using sendgrid API.

Args:

  • t: table = a table with the following fields:
    • t.from: string|nil = sender email
    • t.to: array[string] = recipient emails
    • t.cc: array[string]|nil = CC recipient emails
    • t.bcc: array[string]|nil = BCC recipient emails
    • t.subject: string = email subject
    • t.body: string = email body
    • t.content_type: string|nil = body MIME type, defaults to text/plain.
    • t.timeout: integer|nil = timeout of request in seconds

Returns:

  • ok: boolean = true on success
  • err: Error|nil = error message if ok is falsy

Back to index

About this wiki

commit 3ebfbd288b8e5c95fdf8ce2027a0e94cfa1c8976
Author: Martin Angers <martin.n.angers@gmail.com>
Date:   2021-02-25T14:07:12-05:00

Update to reflect Request:validate_body
Clone this wiki
https://git.sr.ht/~mna/tulip-wiki (read-only)
git@git.sr.ht:~mna/tulip-wiki (read/write)