Answer the question
In order to leave comments, you need to log in
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:
2)
I went to the tab with the sending parameters and copied the link to the API from there:
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'
}
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question