Does Mailgun.js offer the possibility to send a template?
up vote
0
down vote
favorite
So MailGun offers the possibility to send email via their Node library that implements their API:
var mailgun = require('mailgun-js')({ apiKey: api_key, domain: DOMAIN });
var filepath = path.join(__dirname, 'sample.jpg');
var data = {
from: 'Excited User <me@samples.mailgun.org>',
to: 'foo@example.com, baz@example.com, bar@example.com',
cc: 'baz@example.com',
bcc: 'bar@example.com',
subject: 'Complex',
text: 'Testing some Mailgun awesomness!',
html: "<html>HTML version of the body</html>",
attachment: filepath
};
mailgun.messages().send(data, function (error, body) {
console.log(body);
});
And they also offer the possibility to design and create Email Templates. Is there any way to send templated emails with some custom variables via their API? Something like:
var data = {
from: 'Excited User <me@samples.mailgun.org>',
to: 'foo@example.com, baz@example.com, bar@example.com',
template: "withdraw_request_approved", //Instead of 'html'
vars: { firstName: 'John', lastName: 'Doe' }
};
mailgun.messages().send(data, function (error, body) {
console.log(body);
});
If not, could you suggest some other mailing service that offer this kind of functionality? (I've skipped Mandrill since it's apparently currently down, with no clear estimate to when it'll become available again)
node.js email mailgun mailing
add a comment |
up vote
0
down vote
favorite
So MailGun offers the possibility to send email via their Node library that implements their API:
var mailgun = require('mailgun-js')({ apiKey: api_key, domain: DOMAIN });
var filepath = path.join(__dirname, 'sample.jpg');
var data = {
from: 'Excited User <me@samples.mailgun.org>',
to: 'foo@example.com, baz@example.com, bar@example.com',
cc: 'baz@example.com',
bcc: 'bar@example.com',
subject: 'Complex',
text: 'Testing some Mailgun awesomness!',
html: "<html>HTML version of the body</html>",
attachment: filepath
};
mailgun.messages().send(data, function (error, body) {
console.log(body);
});
And they also offer the possibility to design and create Email Templates. Is there any way to send templated emails with some custom variables via their API? Something like:
var data = {
from: 'Excited User <me@samples.mailgun.org>',
to: 'foo@example.com, baz@example.com, bar@example.com',
template: "withdraw_request_approved", //Instead of 'html'
vars: { firstName: 'John', lastName: 'Doe' }
};
mailgun.messages().send(data, function (error, body) {
console.log(body);
});
If not, could you suggest some other mailing service that offer this kind of functionality? (I've skipped Mandrill since it's apparently currently down, with no clear estimate to when it'll become available again)
node.js email mailgun mailing
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
So MailGun offers the possibility to send email via their Node library that implements their API:
var mailgun = require('mailgun-js')({ apiKey: api_key, domain: DOMAIN });
var filepath = path.join(__dirname, 'sample.jpg');
var data = {
from: 'Excited User <me@samples.mailgun.org>',
to: 'foo@example.com, baz@example.com, bar@example.com',
cc: 'baz@example.com',
bcc: 'bar@example.com',
subject: 'Complex',
text: 'Testing some Mailgun awesomness!',
html: "<html>HTML version of the body</html>",
attachment: filepath
};
mailgun.messages().send(data, function (error, body) {
console.log(body);
});
And they also offer the possibility to design and create Email Templates. Is there any way to send templated emails with some custom variables via their API? Something like:
var data = {
from: 'Excited User <me@samples.mailgun.org>',
to: 'foo@example.com, baz@example.com, bar@example.com',
template: "withdraw_request_approved", //Instead of 'html'
vars: { firstName: 'John', lastName: 'Doe' }
};
mailgun.messages().send(data, function (error, body) {
console.log(body);
});
If not, could you suggest some other mailing service that offer this kind of functionality? (I've skipped Mandrill since it's apparently currently down, with no clear estimate to when it'll become available again)
node.js email mailgun mailing
So MailGun offers the possibility to send email via their Node library that implements their API:
var mailgun = require('mailgun-js')({ apiKey: api_key, domain: DOMAIN });
var filepath = path.join(__dirname, 'sample.jpg');
var data = {
from: 'Excited User <me@samples.mailgun.org>',
to: 'foo@example.com, baz@example.com, bar@example.com',
cc: 'baz@example.com',
bcc: 'bar@example.com',
subject: 'Complex',
text: 'Testing some Mailgun awesomness!',
html: "<html>HTML version of the body</html>",
attachment: filepath
};
mailgun.messages().send(data, function (error, body) {
console.log(body);
});
And they also offer the possibility to design and create Email Templates. Is there any way to send templated emails with some custom variables via their API? Something like:
var data = {
from: 'Excited User <me@samples.mailgun.org>',
to: 'foo@example.com, baz@example.com, bar@example.com',
template: "withdraw_request_approved", //Instead of 'html'
vars: { firstName: 'John', lastName: 'Doe' }
};
mailgun.messages().send(data, function (error, body) {
console.log(body);
});
If not, could you suggest some other mailing service that offer this kind of functionality? (I've skipped Mandrill since it's apparently currently down, with no clear estimate to when it'll become available again)
node.js email mailgun mailing
node.js email mailgun mailing
edited Nov 8 at 10:25
asked Nov 8 at 8:38
iuliu.net
2,31911742
2,31911742
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204084%2fdoes-mailgun-js-offer-the-possibility-to-send-a-template%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown