Closed rotexhawk closed 3 years ago
Hi @rotexhawk
I used it the next way and it works OK:
try {
const res = await mg.messages.create(domain, {
from: fromEmail,
to: toEmail,
cc: undefined,
subject: 'Hello 3',
// text: 'Testing some Mailgun awesomeness!',
html: `
<h1>Test email header</h1>
<p>Test email body</p>
`
// attachment: [rackspaceLogo]
});
console.log(res);
} catch (err) {
console.error(err);
}
Maybe you don't have such a domain in a region you use, could you check it, please?
I'm closing this one, if you still have such issue please open a new one.
Having 404
I am trying to run the following example. Keep getting 404 error. I can send a message with curl using the same (my) credentials. Not sure what's going on. Thanks.
mg.messages.create('sandbox-123.mailgun.org', { from: "Excited User <mailgun@sandbox-123.mailgun.org>", to: ["test@example.com"], subject: "Hello", text: "Testing some Mailgun awesomness!", html: "<h1>Testing some Mailgun awesomness!</h1>" }) .then(msg => console.log(msg)) // logs response data .catch(err => console.log(err)); // logs any error