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.

Not able to send messages

See original GitHub issue

I was able to successfully use mailgun-js to add someone to a mailing list, but I’m running into an error (404) sending a message. Sounds like the endpoint may not be configured properly?

Note - I was able to send an email using the curl example in the api docs, so I don’t think it’s an issue with my DNS settings.

Code used:


var api_key = MY_KEY;
var domain = 'https://api.mailgun.net/v3/WWW.MYSITE.COM';
var mailgun = require('mailgun-js')({apiKey: api_key, domain: domain});

    var data = {
      from: 'Me <me@me.com>',
      to: 'example_email@something.com',
      subject: 'Hello',
      html: 'oh hi'
    }

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

error:

127.0.0.1 - - [20/Dec/2015:20:52:16 +0000] "POST /api/v1/subscribe HTTP/1.1" 200 25 "http://localhost:3000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36"
got an error:  { [Error: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server.</p><p>If you entered the URL manually please check your spelling and try again.</p>
] statusCode: 404 }
Message sent: 250 2.0.0 OK 1450644728 y129sm11413404qka.33 - gsmtp

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
bojandcommented, Dec 21, 2015

The domain param should just be your mailgun domain not a full url. so in the case of your sample code just 'WWW.MYSITE.COM'.

1reaction
benrlodgecommented, Dec 22, 2015

In any case, this resolves my issues, thanks for the guidance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix problems sending, receiving or connecting to Messages
Fix problems sending or receiving messages from specific contacts · Delete the contact and add it again. · Check if you blocked them....
Read more >
Can't Send Text Messages From Android? 4 Fixes to Try
What to Do When You Can't Send Text Messages From Android · 1. Check Blocked Numbers · 2. Clear Your Text Message App's...
Read more >
If you can't send or receive messages on your iPhone or iPad
You can set up Messages so that it automatically tries to send messages as an SMS when iMessage isn't available. Go to Settings...
Read more >
7 ways to fix an Android device that won't send text messages
7 ways to fix an Android device that won't send text messages · Restart your phone · Check for updates · Clear your...
Read more >
Text Messages Not Sending? Here Are 10 Reasons Why
Why Is My Text Message Not Sending? · 1. Requiring a Different Type of Phone Number · 2. The Carrier Has Blocked Sending...
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