public void Initialize(SendRequest sendRequest) { if (sendRequest.NetworkCredential == null) { sendRequest.NetworkCredential = new System.Net.NetworkCredential(AppSettingsUtil.GetString("email.username"), AppSettingsUtil.GetString("email.password")); } var sender = new SmtpSender(() => new SmtpClient(sendRequest.SmtpClientHost) { EnableSsl = sendRequest.EnableSsl, DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory, Credentials = sendRequest.NetworkCredential }); EmailSend.DefaultSender = sender; }