question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Send mail, and return undefined

See original GitHub issue

8.0.0 on Mac OS X

const mailgun = new Mailgun({
    apiKey: <API key>,
    domain: <API Base URL>,
});

const data = {
    from: '<Default SMTP Login>',
    to: user.email,
    subject: '<Subjet>',
    html: `<context>`
}

mailgun.messages().send(data, function (err, body) {
    if (err) {
        console.log("got an error: ", err);
    }
    else {
        console.log(body);
    }
});

When I try to log out the body, It just keep returning undefined but didn’t return an error?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15

github_iconTop GitHub Comments

12reactions
jschrcommented, Sep 14, 2017

Spent a while debugging this same error before I came across this issue. I was using the full api url https://api.mailgun.net/v3/<domain> instead of just domain.

Definitely a user error but a proper error message would have helped. Even if it was just an ‘invalid domain’ error.

7reactions
bojandcommented, Jul 27, 2017

Hmm domain should just be something like: 'sandbox12345.mailgun.org'. http://bojand.github.io/mailgun-js/#/?id=options

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nodemailer's sendMail function returns "undefined"
I have the following code. The commented lined never get executed and info.response returns "undefined". Could you help me figure out why it's...
Read more >
Send mail, and return undefined · Issue #150 - GitHub
For me the problem is consistent, and curl works fine. I should also note that the email never sends with mailgun-js. It will...
Read more >
Email.send does not return - help - Meteor forums
Hi, I'm trying to get return value from SMTP server after sending an email but Email.send returns undefined on success.
Read more >
Mail::send is failing with undefined index error - Laracasts
Mail ::send is failing with undefined index error. Hi Guys -. Got a strange one here. I've got the same mail sending code...
Read more >
Email sent to 'Undefined' contact - Microsoft Community
Hi JTo7, As long as the actual email address is correct, it was sent. Undefined was used for the display name for some...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found