Reputation: 5194
I added a new domain to mailgun and also successfully verified it but I am unable to send emails from that domain. I am trying to use the mailgun API to send the emails. I can send emails from the Mailgun sandbox domain but not from my own domain.
I have done the following in my code:
var api_key = 'api-key-here';
var domain = 'https://api.mailgun.net/v3/MY-DOMAIN-NAME.com';
var mailgun = require('mailgun-js')({apiKey: api_key, domain: domain});
Also within my user signup function I have the following:
var data = {
from: 'Excited User <[email protected]>',
to: email,
subject: ' Account Verification',
text: 'Please click on the following link, or paste this into your browser to complete the process:\n\n' + 'http://' + req.headers.host + '/verify/' + token + '\n\n'
};
mailgun.messages().send(data, function(error, body) {
console.log("sending email ")
});
It does not send an email and nothing shows up in the domain logs as well. Any idea what I am doing wrong?
Upvotes: 0
Views: 222
Reputation: 2693
domain
should be just MY-DOMAIN-NAME.com
, not https://api.mailgun.net/v3/MY-DOMAIN-NAME.com
, because mailgun-js
handles that internally.
Upvotes: 0