mailgun-email-delivery-service
Service icon

Mailgun Email Delivery Service

Stable version 1.0.2 (Compatible with OutSystems 11)
Uploaded
 on 03 December 2023
 by 
0.0
 (0 ratings)
mailgun-email-delivery-service

Mailgun Email Delivery Service

Documentation
1.0.0

How to get started

  • Register a Mailgun Account
  • Configure a Email Domain (or use the provided sandbox domain)
  • Install the demo application and try it out


Sending Mails

  • Add a dependency to Mailgun_MessageSend server action in the Mailgun_IS module


This server action takes your API Key and your domain as input parameters. For sending EMails a send only API key is sufficent.

Request Property

  • From - is a name / email address pair. Only the email address is a mandatory field.


If the From address does not correspond to your configured email domain in mailgun then mail clients may display the sender as on behalf of. You can set the SetSenderHeader option to true. In that case the component also sets a special message header (h:sender) corresponding to your from address. This mostly works and your address is display correctly at the recipient. BUT! There is a great chance that the receiving email server either rejects your mail or flags it as junk.


  • To, Cc and Bcc are lists of name / email address pairs.
  • Text and Html - A email can contain different contents for text and html.
  • DeliveryTime - You can specify a date with time in the future. Mailgun will then postpone the sending until that date and time is reached.
  • Tags - You can include additional tag strings to your message. Tags are not sent to the recipient but rather provide the ability to do some additional analytics.
  • Attachments - List of Filename and Binary Data for any attachment you want to include in the mssage
  • Variables - additional Key Value pairs you can attach to an email. Also used for more fine-grained analytics.


Webhooks

You can configure Webhooks for various events in the Mailgun console. The component itself does not provide a REST endpoint to consume Mailgun events.

  • Create a new REST endpoint in your application with one action (eg. hook) accepting a post.
  • Add a Input Parameter (eg. Data) to your Hook endpoint and set the data type to Webhook (from Mailgun_IS module)


  • Configure your REST endpoint service and set Authentication to Custom
  • Add a dependency to GetRequestContent from the HttpRequestHandler module
  • In the OnAuthentication action add GetRequestContent to the flow and set IncludeHeaders to False
  • Add a Deserialize JSON next to the flow. Set JSON String to GetRequestContent.RawContent and Data Type to Webhook (from Mailgun_IS module)
  • Add Mailgun_ValidateWebhook server action from Mailgun_IS module to the flow
  • Set your APIKey (from Mailgun Console)
  • Set Timestamp to DeserializeData.Data.Signature.Timestamp
  • Set Token to DeserializeData.Data.Signature.Token
  • Set Signature to DeserializeData.Data.Signature.Signature
  • Add an IF to the flow and set condition to Mailgun_ValidateWebhook.IsValid
  • In the FALSE branch add a new UserExpcetion ApiException
  • Connect the TRUE branch to End



After successful validation of the webhook the request then passes on to your hook endpoint.