private void AddPart(string part, CONTENTTYPES contentType, string filename, string encoding) { switch (contentType) { case CONTENTTYPES.HTML: case CONTENTTYPES.TEXT: case CONTENTTYPES.NONE: if (_message.Body.Length > 0) { // Add this as an alternate view } else { _message.BodyEncoding = Encoding.ASCII; _message.Body = part.ToString(); } break; default: // Add an Attachment System.Net.Mail.Attachment a = System.Net.Mail.Attachment.CreateAttachmentFromString(part, filename); a.TransferEncoding = System.Net.Mime.TransferEncoding.Base64; _message.Attachments.Add(a); break; } }
private void AddPart(string part, CONTENTTYPES contentType) { AddPart(part, contentType, "",""); }