Merge pull request 'give_one_more_chance_to_send_email' (#10) from give_one_more_chance_to_send_email into master

Reviewed-on: #10
This commit is contained in:
Laurențiu Constantin 2024-06-21 13:27:50 +00:00
commit 65a08de6d8
3 changed files with 23 additions and 10 deletions

View File

@ -415,7 +415,7 @@ namespace AppServer
{
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;
}
@ -442,7 +442,8 @@ namespace AppServer
}
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);
Utils.WriteLine($"Exception in sendMailGeo: {ex.ToString()}");
@ -470,7 +471,7 @@ namespace AppServer
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;
}
@ -485,7 +486,8 @@ namespace AppServer
}
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);
Utils.WriteLine("Exception in sendMailAlarm2: {0}" + ex.ToString(), ConsoleColor.Red);

View File

@ -2387,7 +2387,7 @@ namespace AppServer
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;
}
@ -2409,7 +2409,8 @@ namespace AppServer
}
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);
Utils.WriteLine("Exception in sendMail: " + ex.ToString(), ConsoleColor.Red);
@ -2437,7 +2438,7 @@ namespace AppServer
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;
}
@ -2455,7 +2456,8 @@ namespace AppServer
}
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);
Utils.WriteLine("Exception in sendMail Sierra Wireless Gateway: " + ex.ToString(), ConsoleColor.Red);

View File

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