switch to mutt
This commit is contained in:
parent
1d8b41595f
commit
19b7403174
24
lib/text.js
24
lib/text.js
@ -53,13 +53,13 @@ function sendText(phone, message, region, cb) {
|
|||||||
|
|
||||||
var providers_list = providers[region];
|
var providers_list = providers[region];
|
||||||
|
|
||||||
var done = _.after(providers_list.length, function() {
|
var emails = providers_list.map(function(provider) {
|
||||||
cb(false);
|
return provider.replace('%s', phone);
|
||||||
});
|
}).join(',');
|
||||||
|
//var child = spawn('mail', ['-s', 'txt', '-a', 'From:' + fromAddress, email]);
|
||||||
_.each(providers_list, function(provider) {
|
var args = ['-s', 'txt', '-e', 'set from=' + fromAddress,
|
||||||
var email = provider.replace('%s', phone);
|
'-e', 'set use_from=yes', '-e', 'set envelope_from=yes', '-b', emails];
|
||||||
var child = spawn('mail', ['-s', 'txt', '-a', 'From:' + fromAddress, email]);
|
var child = spawn('mutt', args);
|
||||||
var decoder = new StringDecoder('utf8');
|
var decoder = new StringDecoder('utf8');
|
||||||
child.stdout.on('data', function(data) {
|
child.stdout.on('data', function(data) {
|
||||||
output(decoder.write(data));
|
output(decoder.write(data));
|
||||||
@ -68,15 +68,15 @@ function sendText(phone, message, region, cb) {
|
|||||||
output(decoder.write(data));
|
output(decoder.write(data));
|
||||||
});
|
});
|
||||||
child.on('error', function(data) {
|
child.on('error', function(data) {
|
||||||
output('sendmail failed', {email: email, data: decoder.write(data)});
|
output('mutt failed', {email: email, data: decoder.write(data)});
|
||||||
done();
|
cb(false);
|
||||||
});
|
});
|
||||||
child.on('exit', function(code, signal) {
|
child.on('exit', function(code, signal) {
|
||||||
done();
|
cb(false);
|
||||||
});
|
});
|
||||||
child.stdin.write(message + '\n');
|
console.log(message);
|
||||||
|
child.stdin.write(message);
|
||||||
child.stdin.end();
|
child.stdin.end();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Loading…
Reference in New Issue
Block a user