Reputation: 123
I have a problem with sending emails with mailgun. Email addresses with the same domain as my mailgun domain do not receive emails (other addresses with other domains do).
If my Mailgun domain is domain.com, I cannot send to [email protected] for example
In the logs on mailgun, it is indicated that the email is accepted (but it is never delivered).
here is my code but i think it is a mailgun configuration issue.
const mg = mailgun({ apiKey: process.env.MAILGUN_API_KEY, domain: process.env.MAILGUN_DOMAIN, host: process.env.MAILGUN_HOST })
const data = ...
mg.messages().send(data, function (error, body) {
if(error) {
console.log(error)
const err = new Error('Error sending email')
err.code = 500
throw err
}
})
I dont have any error for this query and I think I configured the DNS records correctly.
MX :
Hostname | priority | currentValue
domaine.com | 10 | mxa.eu.mailgun.org
domaine.com | 10 | mxb.eu.mailgun.org
TXT records are also configured
thank you for your help
Upvotes: 5
Views: 2749
Reputation: 149
This happened to me as well. Just remove the mx records you added for your domain when you setup your mailgun account. Its intercepting the emails, which you probably don't want. See this link for more details, but you really just need to remove those mx[a/b].mailgun.org records you added.
Upvotes: 2
Reputation: 123
resolved
In my case, I just had to use a subdomain in mailgun. Instead of domain.com, I used subdomain.domain.com
Upvotes: 5