MailMessageSaveMessage Method (Stream) |
Namespace: MailBee.Mime
Exception | Condition |
---|---|
MailBeeInvalidArgumentException | stream is a null reference (Nothing in Visual Basic). |
MailBeeStreamException | The given stream does not support writing or stream I/O error occurred, and ThrowExceptions is true. |
The stream should already be opened for reading before this method can be called.
The developer can use LoadMessage(Stream) method to load the previously saved message.
If you need to produce a stream in .MSG format (which can then be opened in MS Outlook), use methods of MsgConvert class.
// To use the code below, import these namespaces at the top of your code. using System.IO; using MailBee; using MailBee.Mime; // The actual code (put it into a method of your class). MailMessage msg = new MailMessage(); msg.LoadMessage(@"C:\Docs\TestMail.eml"); using (FileStream fs = new FileStream(@"C:\Temp\msg.eml", FileMode.CreateNew)) { msg.SaveMessage(fs); }