Beispiel #1
0
 private void ReleaseClient()
 {
     try
     {
         _emailClient.Close();
     }
     catch (Exception e)
     {
         _logger.LogError(e, $"Unexpected Error thrown while Closing _emailClient.");
     }
 }
Beispiel #2
0
 public string SendEmail(Email email)
 {
     _logger.LogInformation($"Sending email to {email.To}");
     try
     {
         _emailClient.SendEmail(email.To, email.Body);
         return("Success!");
     }
     catch (Exception e)
     {
         _logger.LogError(e, $"Error sending email to {email.To}");
         return("Failure.");
     }
     finally
     {
         _emailClient.Close();
     }
 }
 //Separate Close() Method for unit testing
 public string Close()
 {
     _emailClient.Close();
     return("Success!");
 }
Beispiel #4
0
 public IActionResult Logout()
 {
     _emailClient.Close();
     return(RedirectToAction("Index"));
 }