/// <summary> /// Sends an Email Message as a meeting request. /// </summary> /// <param name="aEmailHost">A email host.</param> /// <param name="aEmailArgument">A email argument.</param> public static void SendMeetingRequest(EmailHost aEmailHost, EmailArgument aEmailArgument) { try { using (var vMailMessage = GetMeetingRequest(aEmailArgument)) { SendMail(aEmailHost, vMailMessage); } } catch (Exception ex) { throw new ZpCodedException(SourceAssembly.Common, ex.Message, "SendEmailException", "SendMeetingRequest", "Email", ex.InnerException); } }
/// <summary> /// Sends the mail message via the host. /// </summary> /// <param name="aEmailHost">A email host.</param> /// <param name="aMailMessage">A mail message.</param> private static void SendMail(EmailHost aEmailHost, MailMessage aMailMessage) { using (var smtpClient = new SmtpClient() { Host = aEmailHost.Name, Port = aEmailHost.Port, EnableSsl = aEmailHost.EnableSsl, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = aEmailHost.UseDefaultCredentials, Credentials = new NetworkCredential(aEmailHost.UserID, aEmailHost.Password) }) { smtpClient.Send(aMailMessage); } }