forked from Squatconf/Website
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
10 years ago
|
var fs = require('fs')
|
||
|
, config = require('../../config')
|
||
|
, api_key = config.mailjetKey
|
||
|
, domain = 'squatconf.eu'
|
||
|
, mailgun = require('mailgun-js')({apiKey: api_key, domain: domain})
|
||
|
, MailComposer = require('mailcomposer').MailComposer
|
||
|
, mailcomposer = new MailComposer()
|
||
|
, text = fs.readFileSync('./squatconf-news-02.hex', 'utf8')
|
||
|
, allMail = fs.readFileSync('./mails.txt','utf8').split('\n')
|
||
|
, testMail = ['gorhgorh@gmail.com','gorhgorh@lesnodebots.eu']
|
||
|
;
|
||
|
|
||
|
mailcomposer.setMessageOption({
|
||
|
from: 'no-reply@squatconf.eu',
|
||
|
bcc: allMail,
|
||
|
subject: 'squatConf - newsletter 02',
|
||
|
body: text,
|
||
|
html: '<pre>'+ text + '</pre>'
|
||
|
});
|
||
|
|
||
|
mailcomposer.buildMessage(function(mailBuildError, messageSource) {
|
||
|
|
||
|
var dataToSend = {
|
||
|
to: allMail,
|
||
|
message: messageSource
|
||
|
};
|
||
|
|
||
|
mailgun.messages().sendMime(dataToSend, function (sendError, body) {
|
||
|
if (sendError) {
|
||
|
console.log(sendError);
|
||
|
return;
|
||
|
}
|
||
|
else{
|
||
|
console.log('done');
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
//console.log(allMail);
|