Mailgun: Emails accepted but not delivered for addresses with the same domain
Asked Answered
H

2

5

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

Hendel answered 17/9, 2020 at 9:42 Comment(1)
Were you able to resolve the issue?Decrement
H
5

resolved

In my case, I just had to use a subdomain in mailgun. Instead of domain.com, I used subdomain.domain.com

Hendel answered 17/9, 2020 at 15:50 Comment(0)
E
2

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.

https://help.mailgun.com/hc/en-us/articles/203357040-Can-I-Use-the-Same-Domain-Name-for-Mailgun-and-for-Google-Apps-Or-Another-Email-Server-

Extine answered 11/4, 2023 at 5:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.