Webhook Relay
PricingLogin
  • Introduction
  • Quick Start - Forwarding
  • Quick Start - Tunnels
  • 🛠️Installation
    • Relay CLI
      • Install
      • Auto-start
      • Run config.yaml reference
    • Containerized
      • Kubernetes Installation
      • Podman
      • Docker
      • Docker Compose
  • Products
    • 🛰️Webhook Forwarding
      • Glossary
      • WebSocket Server
      • Authentication
      • Custom Domains
    • ⚡Functions
      • Managing functions
      • Edit request/response
      • Working with JSON
      • 🦾Advanced
        • Working with time
        • Testing functions in CLI
        • Making HTTP Requests
        • Multipart Form Data
        • URLEncoded Form Data
        • GCP BigQuery
        • Sending Emails
        • JWT authentication
        • Base64, Hashes, Encryption
      • 🤖Integrating into CI/CD
    • 🔃Tunnels
      • Using tunnels
      • Custom Domains
      • Encryption (HTTPS)
      • Regions
  • 📝Examples
    • Intro to examples
    • Webhooks
      • Receiving webhooks on localhost
      • Receive webhooks inside your JavaScript app
      • Execute shell scripts on remote machines
    • Functions
      • Enrich webhooks from 3rd party APIs
      • Convert DockerHub webhook to Slack notification
      • Allowing only POST requests through
      • Manipulate webhook request body
    • Tunnels
      • Ingress for any Kubernetes environment
      • Demoing your website
    • 🏠Home Automation
      • Home Assistant
      • Node-RED
      • Raspberry Pi
  • Platform
    • CLI Basics
    • Using CLI Behind Proxy
    • Self-hosting Server
      • Server deployment
      • Client configuration
    • Security & Tech
Powered by GitBook
On this page

Was this helpful?

  1. Products
  2. Functions
  3. Advanced

Sending Emails

Webhook Relay provides a Mailgun package to easily send emails on various events.

PreviousGCP BigQueryNextJWT authentication

Last updated 3 years ago

Was this helpful?

Prerequisites:

  • account (provides generous tier)

Webhook Relay provides a helper package mailgun that can send emails. To start sending emails, create a new Function and just import ‘mailgun’ package. This function will need API key and domain:

-- Import Mailgun helper package
local mailgun = require('mailgun')

local domain = cfg:GetValue('domain')
local api_key = cfg:GetValue('api_key')

-- mailgun.initialize('domain', 'api-key', 'region (us/eu)')
err = mailgun.initialize(domain, api_key, 'us')
if err then error(err) end

-- mailgun.send('sender@foo.com', 'subject', 'body-here', 'recipient@foo.com')
err = mailgun.send('your-email@example.com', 'test subject', 'test body', 'john@example.com')
if err then error(err) end

Then, you will need to enter your API key from the and set the as config variables for your function. You can find more details on how to find your API keys in Mailgun .

⚡
🦾
Mailgun
API keys page
here