forked from danibrear/meteor-sendgrid
-
Notifications
You must be signed in to change notification settings - Fork 3
/
mailgun.js
35 lines (31 loc) · 860 Bytes
/
mailgun.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Usage:
Meteor.startup(function(){
Meteor.Mailgun.config({
username = 'MAILGUN_USERNAME',
password = 'MAILGUN_PASSWORD'
});
});
* In server directory:
Meteor.Mailgun.send({
to: '[email protected]',
from: '[email protected]',
subject: 'A subject',
text: 'This is the text',
html: 'With meteor it''s easy to set up <strong>HTML</strong> <span style="color:red">emails</span> too.'
});
*
*/
Meteor.Mailgun = {
config: function(options){
var protocol = "smtps";
username = options['username'];
password = options['password'];
host = 'smtp.mailgun.org';
port = '465';
process.env.MAIL_URL = `${protocol}://${username}:${password}@${host}:${port}/`;
},
// a wrapper for Email just to be consistent.
send: function(options){
Email.send(options);
}
};