Skip to content

Instantly share code, notes, and snippets.

@sunapi386
Created May 9, 2020 20:25
Show Gist options
  • Save sunapi386/77f35b401694d312c289609b7d8d2abb to your computer and use it in GitHub Desktop.
Save sunapi386/77f35b401694d312c289609b7d8d2abb to your computer and use it in GitHub Desktop.
mailgun example sending
curl -s --user 'api:key-YOURAPIKEYHERE' \
https://api.mailgun.net/v3/mg.example.co/messages \
-F from='Excited User <postmaster@mg.example.co>' \
-F to=j@example.co \
-F subject='Hello' \
-F text='Testing some Mailgun awesomeness!'
import { NodeMailgun } from 'ts-mailgun';
export const mgmailer = new NodeMailgun();
mgmailer.apiKey = 'key-YOURAPIKEYHERE';
mgmailer.domain = 'mg.example.co';
mgmailer.fromEmail = 'j@example.co';
mgmailer.fromTitle = "Fancy Company";
mgmailer.init();
mgmailer.send('j@example.co', 'reset pass', 'reset-password?token=$').then((result) => {
console.log("Done ", result )
}).catch((error) => {
console.log('Error:', error)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment