Mailgun Service | Email validation

Sending email

See the information on How To Start Sending Email page for more details about information in this section.

While it will be Discourse server instance that will send email notification as well as to provide the mailbox management, let's verify that the Mailgun is correctly installed by sending a test email via Mailgun API.

The first action item is to define one authorized recepient as explained in this tutorial. I added my own email ([email protected]}


Image 1

This email address is created as un-verified and Mailgun sends a "query":


Image 2

By clicking on 'I Agree' link, this email address becomes verified:


Image 3

Now, let's use the following simple app to send an email:

var mailgun = require("mailgun-js");
var api_key = 'put-your-key-here';
var DOMAIN = 'mg.didomg.club';
var mailgun = require('mailgun-js')({ apiKey: api_key, domain: DOMAIN });

var data = {
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Hello from the [email protected]',
  text: 'Testing some Mailgun awesomness!'
};

mailgun.messages().send(data, function (error, body) {
  console.log(body);
});

When executing this app (node app.js) we get the following response:

λ node app.js
{ id: '<[email protected]>',
  message: 'Queued. Thank you.' }

and the created email was received as:


Image 4



results matching ""

    No results matching ""