public void Send(RDIFramework.Utilities.Message message) { if (message == null) { throw new ArgumentNullException("message"); } this.ConfigureSender(message); if (this.bool_0) { MailMessage msg = smethod_0(message); Guid msgGuid = new Guid(); SendCompletedEventHandler sceh = null; sceh = delegate(object sender, AsyncCompletedEventArgs e) { if (msgGuid == ((Guid)e.UserState)) { msg.Dispose(); } this.smtpClient_0.SendCompleted -= sceh; }; this.smtpClient_0.SendCompleted += sceh; this.smtpClient_0.SendAsync(msg, msgGuid); } else { using (MailMessage message2 = smethod_0(message)) { this.smtpClient_0.Send(message2); } } }
protected virtual void ConfigureSender(RDIFramework.Utilities.Message message) { if (!this.bool_1) { if (this.HasCredentials) { this.smtpClient_0.Credentials = this.networkCredential_0; } this.smtpClient_0.Port = this.int_0; this.smtpClient_0.EnableSsl = this.EnableSsl; this.bool_1 = true; } }
private static MailMessage smethod_0(RDIFramework.Utilities.Message message_0) { MailMessage message = new MailMessage(message_0.From, message_0.To.Replace(';', ',')); if (!string.IsNullOrEmpty(message_0.Cc)) { message.CC.Add(message_0.Cc); } if (!string.IsNullOrEmpty(message_0.Bcc)) { message.Bcc.Add(message_0.Bcc); } message.Subject = message_0.Subject; message.Body = message_0.Body; message.BodyEncoding = message_0.Encoding; message.IsBodyHtml = message_0.Format == Format.Html; message.Priority = (MailPriority)System.Enum.Parse(typeof(MailPriority), message_0.Priority.ToString()); message.ReplyTo = message_0.ReplyTo; foreach (DictionaryEntry entry in message_0.Headers) { message.Headers.Add((string)entry.Key, (string)entry.Value); } foreach (MessageAttachment attachment in message_0.Attachments) { Attachment attachment2; if (attachment.Stream != null) { attachment2 = new Attachment(attachment.Stream, attachment.FileName, attachment.MediaType); } else { attachment2 = new Attachment(attachment.FileName, attachment.MediaType); } message.Attachments.Add(attachment2); } if ((message_0.Resources != null) && (message_0.Resources.Count > 0)) { AlternateView item = AlternateView.CreateAlternateViewFromString(message_0.Body, message_0.Encoding, "text/html"); foreach (string str in message_0.Resources.Keys) { LinkedResource resource = message_0.Resources[str]; resource.ContentId = str; if (resource.ContentStream != null) { item.LinkedResources.Add(resource); } } message.AlternateViews.Add(item); } return(message); }