Search code examples
node.jsmailgun

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


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


Solution

  • resolved

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