Mailgun in Javascript

Mailgun is a great email service with reasonable pricing, including a fantastic free tier.

Once you set up the account, sending email from NodeJS is incredibly easy.

var api_key = 'MY_API_KEY';
var domain = 'mg.MYDOMAIN.com';
var mailgun = require('mailgun-js')({apiKey: api_key, domain: domain});
  
var data = {
  from: 'Some User <SOMEUSER@MYDOMAIN.com>',
  to: 'person1@example.com,person2@example.com',
  subject: 'Hello',
  text: 'This is a test!',
  html: 'This is a <b>test</b>!'
};
  
mailgun.messages().send(data, function (error, body) {
  console.log(body);
});

Comments

Popular posts from this blog

C# Record Serialization

Add timestamp to photo using ImageMagick

Read/write large blob to SQL Server from C#