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 <[email protected]>' \
-F [email protected] \
-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 = '[email protected]';
mgmailer.fromTitle = "Fancy Company";
mgmailer.init();
mgmailer.send('[email protected]', '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