Mailgun integration

How to configure sending email using Mailgun

Mailgun is an email delivery service for sending, receiving, and tracking emails. Aidbox offers integrations with Mailgun to simplify sending notifications via email.

Create Mailgun account

You can do that account by following Mailgun Documentation.

Add environment variables to the docker-compose.yaml


You can find more about Mailgun environment variables here.

Creating NotificationTemplate resource

NotificationTemplate is a resource that stores the body of a mail message.

PUT /NotificationTemplate/notification-template-1
content-type: text/yaml
accept: text/yaml

template: <b>Hello world! Mustache value from Notification.providerData.payload - {{}}</b>

Creating Notification resource

PUT /Notification/notification-1
content-type: text/yaml
accept: text/yaml

provider: 'mailgun-provider'         # Provider id
  to:          # Email of recipient
  subject: My subject of the message # subject of email
  template:                          # Notification template 
    id: notification-template-1
    resourceType: NotificationTemplate
  payload:                           # Data that can be used in the template
      bar: zaz

Call notify method

POST /Notification/notification-1/$send

Example of email sent from the template above

Last updated