public SmtpFailedRecipientsException(string message, SmtpFailedRecipientException[] innerExceptions) { }
public static string SendEmail(MailMessage InMailMessage, string InSMTPServer, NetworkCredential InNetworkCredentials, bool InIsEnableSSL = false, IEnumerable <Attachment> InMailAttachments = null) { string str; if (InMailMessage == null) { throw new ArgumentNullException("InMailMessage"); } if (string.IsNullOrEmpty(InSMTPServer)) { throw new ArgumentNullException("InSMTPServer"); } if (InMailAttachments != null) { foreach (Attachment inMailAttachment in InMailAttachments) { InMailMessage.Attachments.Add(inMailAttachment); } } try { try { SmtpClient smtpClient = new SmtpClient(); string[] strArrays = InSMTPServer.Split(new char[] { ':' }); smtpClient.Host = strArrays[0]; if ((int)strArrays.Length > 1) { smtpClient.Port = Convert.ToInt32(strArrays[1]); } if (InNetworkCredentials == null) { smtpClient.UseDefaultCredentials = true; } else { smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = InNetworkCredentials; } smtpClient.EnableSsl = InIsEnableSSL; smtpClient.Send(InMailMessage); str = ""; } catch (SmtpFailedRecipientException smtpFailedRecipientException1) { SmtpFailedRecipientException smtpFailedRecipientException = smtpFailedRecipientException1; str = string.Format("FailedRecipient {0}", smtpFailedRecipientException.FailedRecipient); throw new Exception(str, smtpFailedRecipientException); } catch (SmtpException smtpException1) { SmtpException smtpException = smtpException1; str = string.Format("SMTPConfigurationProblem {0}", smtpException.Message); throw new Exception(str, smtpException); } catch (Exception exception1) { Exception exception = exception1; str = (exception.InnerException == null ? exception.Message : string.Concat(exception.Message, Environment.NewLine, exception.InnerException.Message)); throw new Exception(str, exception); } } finally { InMailMessage.Dispose(); } return(str); }