-
Got mailgun configured to send emails from my chiubaca.com domain.
- Had to add a bunch of
TXT
,MX
andCNAME
records to my domain DNS which was not on google domains but on Netlify as the namespaces had been forwarded to Netlify. #note-to-self
- Had to add a bunch of
-
When sending emails via EU region on Mailgun , make sure to include the
url
property when setting up the mailgun client
const API_KEY = "xxxxxxxxXxxxxxxxxxxxxxxxxxxx-xxxxxxx-xxxxxx";
const DOMAIN = "mydomaim.com";
const formData = require('form-data');
const Mailgun = require('mailgun.js');
const mailgun = new Mailgun(formData);
const client = mailgun.client({username: 'api', key: API_KEY, url:"https://api.eu.mailgun.net"});
// console.log(client)
const messageData = {
from: 'Yoopster <[email protected]>',
to: '[email protected]',
subject: 'Hello',
text: 'Testing some Mailgun awesomeness!'
};
client.messages.create(DOMAIN, messageData)
.then((res) => {
console.log(res);
})
.catch((err) => {
console.error(err);
});
- https://stackoverflow.com/a/71574225/7207193