Created
May 9, 2020 20:25
-
-
Save sunapi386/77f35b401694d312c289609b7d8d2abb to your computer and use it in GitHub Desktop.
mailgun example sending
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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