Fix invioemail allarme da conf
This commit is contained in:
@@ -47,13 +47,17 @@ namespace MP_TAB_SERV.Components
|
||||
protected bool isSending = false;
|
||||
protected int NumRecPage = 10;
|
||||
protected int PageNum = 1;
|
||||
|
||||
protected int TotalCount = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<string> AlarmsDest { get; set; } = new List<string>();
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration config { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
@@ -96,6 +100,15 @@ namespace MP_TAB_SERV.Components
|
||||
CurrPeriodo = new Periodo(PeriodSet.LastWeek);
|
||||
await doUpdate();
|
||||
}
|
||||
var rawDest = config.GetValue<string>("AlarmDest");
|
||||
if (!string.IsNullOrEmpty(rawDest))
|
||||
{
|
||||
AlarmsDest = rawDest.Split(",").ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
AlarmsDest = new List<string>() { "samuele@steamware.net" };
|
||||
}
|
||||
}
|
||||
|
||||
protected void SaveNumRec(int newNum)
|
||||
@@ -118,8 +131,8 @@ namespace MP_TAB_SERV.Components
|
||||
isSending = true;
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
List<string> dest = new List<string>();
|
||||
dest.Add("samuele@steamware.net");
|
||||
//List<string> dest = new List<string>();
|
||||
//dest.Add("samuele@steamware.net");
|
||||
string oggetto = $"Notifica allarme impianto {currAlarm.MachineId}";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("Attenzione: allarme presente per un periodo superiore alla soglia di controllo.");
|
||||
@@ -131,7 +144,7 @@ namespace MP_TAB_SERV.Components
|
||||
string corpo = sb.ToString().Replace($"{Environment.NewLine}", "<br/>");
|
||||
MailKitMailData mData = new MailKitMailData()
|
||||
{
|
||||
To = dest,
|
||||
To = AlarmsDest,
|
||||
Subject = oggetto,
|
||||
Body = corpo
|
||||
};
|
||||
@@ -140,11 +153,11 @@ namespace MP_TAB_SERV.Components
|
||||
{
|
||||
// salvo invio Notifica allarme
|
||||
TabDServ.AlarmLogSetNotify(currAlarm.AlarmLogId, DateTime.Now);
|
||||
Log.Info($"Notifica allarme {currAlarm.AlarmLogId} inviato a {string.Join(",", dest)}");
|
||||
Log.Info($"Notifica allarme {currAlarm.AlarmLogId} inviato a {string.Join(",", AlarmsDest)}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"Errore in invio email allarmi attivi per {currAlarm.AlarmLogId}");
|
||||
Log.Error($"Errore in invio email allarmi attivi per {currAlarm.AlarmLogId} | tentato invio a {string.Join(",", AlarmsDest)}");
|
||||
}
|
||||
isSending = false;
|
||||
await Task.Delay(1);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2310.1211</Version>
|
||||
<Version>6.16.2310.1212</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB_SERV</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2310.1211</h4>
|
||||
<h4>Versione: 6.16.2310.1212</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2310.1211
|
||||
6.16.2310.1212
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2310.1211</version>
|
||||
<version>6.16.2310.1212</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
"ImgBasePath": "C:\\Steamware\\macchine",
|
||||
"CodModulo": "MoonPro"
|
||||
},
|
||||
"AlarmDest": "samuele.locatelli@egalware.com, ceo@steamware.net",
|
||||
"MailKitMailSettings": {
|
||||
"DisplayName": "MAPO EgalWare Email BOT",
|
||||
"From": "steamwarebot@outlook.it",
|
||||
|
||||
Reference in New Issue
Block a user