private async Task <SmtpClient> EmailConnection(string encryptedKey) { try { SmtpClient client = new SmtpClient("smtp.gmail.com", 587); EncryptionDecryption encryption = EncryptionDecryption.CreateInstance(); if (!string.IsNullOrEmpty(encryptedKey)) { NetworkKeyDTO creds = JsonConvert.DeserializeObject <NetworkKeyDTO>(encryptedKey); client.Credentials = new NetworkCredential(encryption.DecryptText(creds.EncryptedUserName, creds.EncryptedUserMessage), encryption.DecryptText(creds.EncryptedKey, creds.EncryptedMessage)); } return(client); } catch (Exception ep) { Console.WriteLine("failed to send email with the following error:"); Console.WriteLine(ep.Message); throw ep; } }
public TwoStepAuth() { GetEncryptionDecryption = EncryptionDecryption.CreateInstance(); GetSecureAccess = Authentication.CreateInstance(); }