Skip to content

moremi/mailgun-js-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mailgun Node SDK

A simple Mailgun SDK to send e-mails. Fork of https://github.com/mocallu/mailgun-js-sdk

Install

npm install @nuteruls/mailgun-js-sdk

Setup

const MailgunSDK = require('mailgun-js-sdk');
const Mailgun = new MailgunSDK({
    apiKey: 'YOUR_API_KEY', // Required
    baseUrl: 'https://api.eu.mailgun.net/v3/'
});

Send a message

async function sendMessage() => {
    const domain = 'domain.used.on.mailgun.org';
    const message = {
        from: 'From Name <from@email.com>',
        to: 'To <to@email.com>',
        subject: 'Mocallu Mailgun SDK Test',
        text: 'This is a simple e-mail test',
        html: `<html><strong>This is a simple e-mail test</strong></html>`,
        'o:tag': 'test-sdk',
        'o:testmode': true,
    };
    const result = await Mailgun.sendMessage(domain, message);
    console.log(result);
};
sendMessage();

Getting domains

const domainsList = Mailgun.getDomains();
const domain = Mailgun.getDomains('especific.domain.mailgun.org');

This SDK is not finished, feel free to help on development.

About

A simple Node.js Mailgun SDK.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%