Inheritance: AttachmentBase
Exemplo n.º 1
0
 public static Attachment CreateAttachmentFromString(string content, string name, Encoding contentEncoding, string mediaType)
 {
     if (content == null)
         throw new ArgumentNullException("content");
     MemoryStream ms = new MemoryStream();
     StreamWriter sw = new StreamWriter(ms, contentEncoding);
     sw.Write(content);
     sw.Flush();
     ms.Position = 0;
     Attachment a = new Attachment(ms, name, mediaType);
     a.TransferEncoding = ContentType.GuessTransferEncoding(contentEncoding);
     //a.ContentType.CharSet = sw.Encoding.BodyName;
     return a;
 }
Exemplo n.º 2
0
 public static Attachment CreateAttachmentFromString(string content, string name)
 {
     if (content == null)
         throw new ArgumentNullException("content");
     MemoryStream ms = new MemoryStream();
     StreamWriter sw = new StreamWriter(ms);
     sw.Write(content);
     sw.Flush();
     ms.Position = 0;
     Attachment a = new Attachment(ms, new ContentType("text/plain"));
     a.TransferEncoding = TransferEncoding.QuotedPrintable;
     a.Name = name;
     return a;
 }