R
R
romaro2021-05-02 14:21:55
Mail server
romaro, 2021-05-02 14:21:55

Why doesn't sending mail with Mailgun work?

Support, alas, is silent for the third day :(
The network is full of videos on how to set up sending mail via sandbox. And it works great. But as soon as I try to change the data to my domain, I get an authorization error.

What I do:
1) Created a sending key on domain tab:
608e86be359ba172401425.jpeg

2)
I went to the tab with the sending parameters and copied the link to the API from there:
608e874faa22b328294592.jpeg

3)
I replaced the sendbox parameters, under which everything works:

export default {
    apiKey: '260e91b48e1ffa96506***********db5a1a-4b1aa784-19399575',
    baseUrl: 'https://api.mailgun.net/v3/sandboxe0d440504********8b02d6b258.mailgun.org',
    domain: 'sandboxe0d4405042ab4**********b02d6b258.mailgun.org'
}


To the parameters of your domain:
608e8801ecf82087911232.jpeg

And immediately stops authorizing me:
608e888d78036796535747.jpeg

I tried to change the keys, added a subdomain, the result is the same. I ran out of ideas :(
I thought maybe because I have a free account, but they seem to have 3000 letters as a gift.

PS I set up domain records:
608e8b2d380b1505527501.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
romaro, 2021-05-03
@romaro

Solved the problem.
The fact is that mailgun-js by default accesses the api.mailgun.net server, and I registered a domain in the European zone, which is served by another server: api.eu.mailgun.net. Therefore, the host parameter had to be passed to the class constructor:


`Mailgun` object constructor options:
* `apiKey` - Your Mailgun API KEY
* `publicApiKey` - Your public Mailgun API KEY
* `domain` - Your Mailgun Domain (Please note: domain field is `MY-DOMAIN-NAME.com` , not https://api.mailgun.net/v3/MY-DOMAIN-NAME.com )
* `mute` - Set to `true` if you wish to mute the console error logs in `validateWebhook()` function
* ` proxy` - The proxy URI in format `http[s]:// host:port `. ex: `' proxy.example.com:8080 '`
* `timeout` - Request timeout in milliseconds
* `host` - the mailgun host (default: 'api.mailgun.net'). Note that if you are using the EU region the host should be set to 'api.eu.mailgun.net'
* `protocol` - the mailgun protocol (default: 'https:', possible values: 'http:' or 'https:')
* `port` - the mailgun port (default: '443')
* `endpoint` - the mailgun host (default: '/v3')
* `retry` - the number of **total attempts** to do when performing requests. Default is `1`.
That is, we will try an operation only once with no retries on error. You can also use a config
object compatible with the `async` library for more control as to how the retries take place.
See docs [here]( https://caolan.github.io/async/docs.html#retry )
* `testMode` - turn test mode on. If test mode is on, no requests are made,

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question