give_one_more_chance_to_send_email #10

Merged
laurentiu.constantin merged 1 commits from give_one_more_chance_to_send_email into master 2024-06-21 13:27:50 +00:00
3 changed files with 23 additions and 10 deletions

View File

@ -415,7 +415,7 @@ namespace AppServer
{ {
if (MainForm.IsBlacklistedAddress(mailAdr)) if (MainForm.IsBlacklistedAddress(mailAdr))
{ {
Utils.WriteLine($"sendMailGeo : The email was not sent. Email address '{mailAdr}' is in blacklist "); Utils.WriteLine($"sendMailGeo : The email '{subj}' was not sent. Email address '{mailAdr}' is in blacklist count = {MainForm.blackListAddress[mailAdr]}");
return; return;
} }
@ -442,7 +442,8 @@ namespace AppServer
} }
catch (Exception ex) catch (Exception ex)
{ {
if (ex.ToString().Contains("timed out")) if (ex.ToString().Contains("timed out") ||
ex.ToString().Contains("the client was not authenticated"))
MainForm.HandleTimeoutError(mailAdr); MainForm.HandleTimeoutError(mailAdr);
Utils.WriteLine($"Exception in sendMailGeo: {ex.ToString()}"); Utils.WriteLine($"Exception in sendMailGeo: {ex.ToString()}");
@ -470,7 +471,7 @@ namespace AppServer
if (MainForm.IsBlacklistedAddress(mailAdr)) if (MainForm.IsBlacklistedAddress(mailAdr))
{ {
Utils.WriteLine($" sendAlarmMail : The email was not sent. Email address '{mailAdr}' is in blacklist "); Utils.WriteLine($" sendAlarmMail : The email '{title}' was not sent. Email address '{mailAdr}' is in blacklist count = {MainForm.blackListAddress[mailAdr]}");
return; return;
} }
@ -485,7 +486,8 @@ namespace AppServer
} }
catch (Exception ex) catch (Exception ex)
{ {
if (ex.ToString().Contains("timed out")) if ( ex.ToString().Contains("timed out") ||
ex.ToString().Contains("the client was not authenticated"))
MainForm.HandleTimeoutError(mailAdr); MainForm.HandleTimeoutError(mailAdr);
Utils.WriteLine("Exception in sendMailAlarm2: {0}" + ex.ToString(), ConsoleColor.Red); Utils.WriteLine("Exception in sendMailAlarm2: {0}" + ex.ToString(), ConsoleColor.Red);

View File

@ -2387,7 +2387,7 @@ namespace AppServer
if (MainForm.IsBlacklistedAddress(mailAdr)) if (MainForm.IsBlacklistedAddress(mailAdr))
{ {
Utils.WriteLine($"sendMailGeo : The email was not sent. Email address '{mailAdr}' is in blacklist "); Utils.WriteLine($"sendMail : The email was not sent. Email address '{mailAdr}' is in blacklist count = {MainForm.blackListAddress[mailAdr]}");
return; return;
} }
@ -2409,7 +2409,8 @@ namespace AppServer
} }
catch (Exception ex) catch (Exception ex)
{ {
if (ex.ToString().Contains("timed out")) if (ex.ToString().Contains("timed out") ||
ex.ToString().Contains("the client was not authenticated"))
MainForm.HandleTimeoutError(mailAdr); MainForm.HandleTimeoutError(mailAdr);
Utils.WriteLine("Exception in sendMail: " + ex.ToString(), ConsoleColor.Red); Utils.WriteLine("Exception in sendMail: " + ex.ToString(), ConsoleColor.Red);
@ -2437,7 +2438,7 @@ namespace AppServer
if (MainForm.IsBlacklistedAddress(mailAdr)) if (MainForm.IsBlacklistedAddress(mailAdr))
{ {
Utils.WriteLine($"sendMailGeo : The email was not sent. Email address '{mailAdr}' is in blacklist "); Utils.WriteLine($"sendMail_SW : The email was not sent. Email address '{mailAdr}' is in blacklist count = {MainForm.blackListAddress[mailAdr]}");
return; return;
} }
@ -2455,7 +2456,8 @@ namespace AppServer
} }
catch (Exception ex) catch (Exception ex)
{ {
if (ex.ToString().Contains("timed out")) if (ex.ToString().Contains("timed out") ||
ex.ToString().Contains("the client was not authenticated"))
MainForm.HandleTimeoutError(mailAdr); MainForm.HandleTimeoutError(mailAdr);
Utils.WriteLine("Exception in sendMail Sierra Wireless Gateway: " + ex.ToString(), ConsoleColor.Red); Utils.WriteLine("Exception in sendMail Sierra Wireless Gateway: " + ex.ToString(), ConsoleColor.Red);

View File

@ -393,8 +393,17 @@ namespace SafeMobileLib
private void ConnectAsync() private void ConnectAsync()
{ {
if (popClient != null && popClient.Connected) try
popClient.Disconnect(); {
if (popClient != null && popClient.Connected)
popClient.Disconnect();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
popClient = null; popClient = null;
popClient = new Pop3Client(); popClient = new Pop3Client();