MsgConvertRtfInEmlMethod Property |
Gets or sets if RTF text body from .MSG message should be added as an attachment or as a body part into the resulting .EML message, or not added at all.
Namespace: MailBee.OutlookAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public RtfInEmlStorageMethod RtfInEmlMethod { get; set; }
Public Property RtfInEmlMethod As RtfInEmlStorageMethod
Get
Set
Property Value
Type:
RtfInEmlStorageMethodThe default value is
None which means that RTF part
will not be added to the .EML message.
Remarks If you set this property to
AsAttachment,
MailBee will add RTF (rich-text format) body of .MSG message as .RTF attachment named "richbody.rtf" to
the resulting .EML message (into its
Attachments collection). If you, however,
need this body to be added to
BodyParts collection
where plain-text and HTML bodies usually reside, set this property value to
AsBodyPart before making the conversion. This is useful if you need to get the contents
of the RTF body as a string (for instance, if you assign its value to
Rtf (
System.Windows.Forms.RichTextBox.Rtf) property to display it
in a
RichTextBox control).
Note |
---|
This property makes sense only for ".MSG to .EML" direction of conversion. It's not used for ".EML to .MSG" conversions. |
Examples This sample displays RTF body of .MSG message in
RichTextBox ((
System.Windows.Forms.RichTextBox)) control of a WinForms application.
It's assumed
MailBee.Global.LicenseKey is already assigned (for instance, in app.config or web.config file) and the application form contains richTextBox1 control.
Note |
---|
If you prefer to open RTF with WordPAD (or with another program which opens .RTF files in your system) instead of feeding RTF data to the RichTextBox control,
you should rather set RtfInEmlMethod property to AsAttachment,
perform the conversion, then save "richbody.rtf" in Attachments collection
of the resulting MailMessage into a file, and open that file in WordPAD. |
using MailBee.Outlook;
using MailBee.Mime;
MsgConvert conv = new MsgConvert();
conv.RtfInEmlMethod = RtfInEmlStorageMethod.AsBodyPart;
MailMessage msg = conv.MsgToMailMessage("test.msg");
if (msg.BodyParts["text/rtf"] != null)
{
richTextBox1.Rtf = msg.BodyParts["text/rtf"].Text;
}
Imports MailBee.Outlook
Imports MailBee.Mime
Dim conv As MsgConvert = New MsgConvert
conv.RtfInEmlMethod = RtfInEmlStorageMethod.AsBodyPart
Dim msg As MailMessage = conv.MsgToMailMessage("test.msg")
If Not msg.BodyParts("text/rtf") Is Nothing Then
richTextBox1.Rtf = msg.BodyParts("text/rtf").Text
End If
See Also