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 (nik@aureliatools.com}


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: 'postmaster@mg.didomg.club',
  to: 'nik@aureliatools.com',
  subject: 'Hello from the postmaster@mg.didomg.club',
  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: '<20171218000226.2418.CF7315837EEAD968@mg.didomg.club>',
  message: 'Queued. Thank you.' }

and the created email was received as:


Image 4



results matching ""

    No results matching ""