SMS E-Mail Gateway alert support separately from original E-Mail lists

This commit is contained in:
Akkadius 2017-10-04 15:11:19 -05:00
parent 43cd05027a
commit 0ca026c8c7
5 changed files with 12 additions and 223 deletions

32
app.js
View File

@ -684,16 +684,6 @@ fs = require('fs');
var email_body = fs.readFileSync('./public/templates/email_template.html', "utf8"); var email_body = fs.readFileSync('./public/templates/email_template.html', "utf8");
console.log("[Glass Server] Loading E-Mail template... DONE..."); console.log("[Glass Server] Loading E-Mail template... DONE...");
console.log("[Glass Server] Loading SMS domains");
var sms_domains = fs.readFileSync('./lib/sms_domains.txt', "utf8");
var sms_domains_list = [];
var lines = sms_domains.split('\n');
for(var i = 0; i < lines.length; i++){
sms_domains_list[lines[i].trim()] = true;
}
console.log("[Glass Server] Loading SMS domains DONE");
function email_alert(alert_title, alert_message) { function email_alert(alert_title, alert_message) {
/* E-Mail Template Load */ /* E-Mail Template Load */
@ -711,24 +701,6 @@ function email_alert(alert_title, alert_message) {
email_body = email_body.replace("[alert_title]", alert_title); email_body = email_body.replace("[alert_title]", alert_title);
email_body = email_body.replace("[local_time]", new Date().toString() ); email_body = email_body.replace("[local_time]", new Date().toString() );
glass_config.email_alert_to = glass_config.email_alert_to.replace(/ /g,'');
var sms_emails = "";
var individual_emails = glass_config.email_alert_to.split(",");
for(var i = 0; i < individual_emails.length; i++) {
var domain = individual_emails[i].split("@")[1];
var email_address = individual_emails[i];
if(typeof domain !== "undefined") {
if (sms_domains_list[domain.trim()]) {
console.log("This is a mobile sms gateway");
sms_emails = sms_emails + email_address + ", ";
glass_config.email_alert_to = glass_config.email_alert_to.replace(email_address, "");
}
}
}
/* Clean extra commas etc. */ /* Clean extra commas etc. */
glass_config.email_alert_to = glass_config.email_alert_to.replace(/^[,\s]+|[,\s]+$/g, '').replace(/,[,\s]*,/g, ','); glass_config.email_alert_to = glass_config.email_alert_to.replace(/^[,\s]+|[,\s]+$/g, '').replace(/,[,\s]*,/g, ',');
@ -751,10 +723,10 @@ function email_alert(alert_title, alert_message) {
} }
/* Send SMS */ /* Send SMS */
if(glass_config.email_alert_to.trim() != "") { if(glass_config.sms_alert_to.trim() != "") {
var mailOptions = { var mailOptions = {
from: "Glass Alerting Monitor glass@noreply.com", from: "Glass Alerting Monitor glass@noreply.com",
to: sms_emails, to: glass_config.sms_alert_to,
subject: "[Glass] " + alert_title, subject: "[Glass] " + alert_title,
html: alert_message.substring(0, 135) + "...", html: alert_message.substring(0, 135) + "...",
}; };

View File

@ -12,5 +12,6 @@
"ip_ranges_to_allow": [ "ip_ranges_to_allow": [
"" ""
], ],
"email_alert_to": "" "email_alert_to": "",
"sms_alert_to": ""
} }

View File

@ -1,191 +0,0 @@
aircel.co.in
airtelap.com
airtelkk.com
sms.airfiremobile.com
mms.aiowireless.net
msg.acsalaska.com
sms.wirefree.informe.ca
mms.alltelwireless.com
vzwpix.com
paging.acswireless.com
airtelap.com
ideacellular.net
vmobl.com
mms.att.net
page.att.net
sms.beemail.ru
txt.bell.ca
bellsouth.cl
mms.myblueworks.com
psms.bluesky.as
myboostmobile.com
mms.bouyguestelecom.fr
mms.boxis.net
sfr.fr
cellcom.quiktxt.com
csouth1.com
cwemail.com
sms.cvalley.net
mail.msgsender.com
airtelchennai.com
rpgmail.net
139.com
mms.gocbw.com
clarotorpedo.com.br
ideasclaro-ca.com
vtexto.com
sms.cleartalk.us
iclaro.com.co
mms.mycricket.com
cspire1.com
messaging.accessyou.com
mgw.mmsc1.hkcsl.com
sms.ctimovil.com.ar
airtelmail.com
digitextdm.com
sms.advantagecell.net
smsmail.eplus.de
sms.edgewireless.com
SMS.elementmobile.net
emtelworld.net
echoemail.net
esendex.net
sms.fido.ca
subdomain.firmensms.at
smssturen.com
mobile.gci.net
msg.globalstarusa.com
sms.globul.bg
airtelmail.com
ideacellular.net
gscsms.com
vtxt.com
ideacellular.net
airtelmail.com
celforce.com
sms.cellinkgy.com
airtelmail.com
escotelmobile.com
hawaii.sprintpcs.com
sms.haysystems.com
myhelio.com
airtelmail.com
sms.ice.cr
number.iws@iwspcs.net
iwirelesshometext.com
mobile.kajeet.net
airtelkk.com
airtelkerala.com
escotelmobile.com
airtelkol.com
msg.telus.com
text.longlines.com
sms.lynxmobility.com
m1.com.sg
airtelmail.com
airtelmail.com
ideacellular.net
cwmovil.com
sms.mediaburst.co.uk
mymetropcs.com
sms.mtel.net
sms.mobitel.lk
sms.movistar.net.ar
movistar.com.co
0movistar.net
movimensaje.com.ar
sms.movistar.com.uy
sms.co.za
text.mtsmobility.com
airtelmail.com
my-cool-sms.com
sms.ntwls.net
msgnextel.com.mx
TwoWay.11nextel.net.ar
o2online.de
sms.is
sms.orange.nl
orange.net
vzwpix.com
nine-digit-zsend.com
alertas.personal.com.ar
text.plusgsm.pl
sms.pocket.com
mobiletxt.ca
text.plusgsm.pl
qwestmp.com
mms.att.net
mms.rogers.com
pcs.sasktelmobility.com
sendega.com
mas.aw
box.is
smtext.com
send.smsbroadcast.com.au
sms.smscentral.com.au
smspup.com
page.southernlinc.com
rinasms.com
SpikkoSMS.com
pm.sprint.com
mms.att.net
tmomail.net
vzwpix.com
tracfone.plspictures.com
mmst5.tracfone.com
gsm.sunrise.ch
rinasms.com
sms.teletopiasms.no
tmomail.net
optusmobile.com.au
sms.t-mobile.at
sms.t-mobile.hr
t-mobile-sms.de
gin.nl
919894airtelmobile.com
9842airsms.com
sms.tele2.se
etxt.co.nz
teleflip.com
mobile@sms.tim.telstra.com
mms.telusmobility.com
esms.nu
sms.tigo.com.co
timnet.com
message.ting.com
mmst5.tracfone.com
txtlocal.co.uk
itelcel.com
utext.com
viawebsms.com
union-tel.com
mms.uscc.net
usamobility.net
sms.utbox.net
escotelmobile.com
vzwpix.com
mmsviaero.com
torpedoemail.com.br
vmobile.ca
vmpix.com
vxtras.com
voda.co.za
vodafone-sms.de
sms.vodafone.it
sms.vodafone.
0vodafone.es
mtxt.co.nz
text.voyagermobile.com
sms.wcc.net
txt.windmobile.ca
sms.xit.net
vtext.com
txt.att.net
sms.alltelwireless.com
sms.myboostmobile.com
vmobl.com
text.republicwireless.com
messaging.sprintpcs.com
mymetropcs.com
tmomail.net
email.uscc.net

View File

@ -16,7 +16,8 @@ router.post('/', authorize.auth, function(req, res, next) {
glass_config.leases_per_minute_threshold = request.leases_per_minute_threshold; glass_config.leases_per_minute_threshold = request.leases_per_minute_threshold;
glass_config.slack_webhook_url = request.slack_webhook_url; glass_config.slack_webhook_url = request.slack_webhook_url;
glass_config.slack_alert_channel = request.slack_alert_channel; glass_config.slack_alert_channel = request.slack_alert_channel;
glass_config.email_alert_to = request.email_alert_to glass_config.email_alert_to = request.email_alert_to;
glass_config.sms_alert_to = request.sms_alert_to;
json_file.writeFile('./config/glass_config.json', glass_config, {spaces: 2}, function(err) { json_file.writeFile('./config/glass_config.json', glass_config, {spaces: 2}, function(err) {
console.error(err); console.error(err);

View File

@ -44,6 +44,12 @@ router.get('/', authorize.auth, function(req, res, next) {
'<input type="input" class="form-control" id="email_alert_to" placeholder="email@example.com, email2@example.com" value="' + glass_config.email_alert_to + '">' '<input type="input" class="form-control" id="email_alert_to" placeholder="email@example.com, email2@example.com" value="' + glass_config.email_alert_to + '">'
); );
/* SMS Send To */
input = input + template_render.form_input(
'SMS Gateway E-Mails <i class="material-icons" style="font-size: 16px !important;">perm_phone_msg</i>',
'<input type="input" class="form-control" id="email_alert_to" placeholder="smsgatewayemail@example.com, smsgatewayemail@example.com" value="' + glass_config.sms_alert_to + '">'
);
// <div id="glass_settings_result"></div> // <div id="glass_settings_result"></div>
form_data = template_render.form_body("glass-notifications-form", input); form_data = template_render.form_body("glass-notifications-form", input);