Mailgun Domain not found: abc.com

前端 未结 7 1078
遇见更好的自我
遇见更好的自我 2021-02-07 00:17

I am trying to setup emails with my own website. Let\'s say the domain name is abc.com.

The nameserver in use is digital ocean and I also have a gmail accou

7条回答
  •  北海茫月
    2021-02-07 00:45

    I am using the EU region with Mailgun and have run into this problem myself. My implementation is a Node.js application with the mailgun-js NPM package.

    EU Region Implementation:

    const mailgun = require("mailgun-js");
    const API_KEY = "MY_API_KEY";   // Add your API key here
    const DOMAIN = "my-domain.com"; // Add your domain here
    const mg = mailgun({
        apiKey: API_KEY,
        domain: DOMAIN,
        host: "api.eu.mailgun.net"  // -> Add this line for EU region domains
    });
    const data = {
        from: "Support ",
        to: "recipient@example.com",
        subject: "Hello",
        text: "Testing some Mailgun awesomness!"
    };
    mg.messages().send(data, function(error, body) {
        if (error) {
            console.log(error);
        } else {
            console.log(body);
        }
    });
    

    Further options for the mailgun() constructor can be found here.

    Thought I'd share a full answer for anybody that's still confused. Additionally, Mailgun Support was kind enough to supply the following table as a reference guide:

提交回复
热议问题