locked
How to create Multipart MIME message to handle RTF text using C# RRS feed

  • Question

  • How can we create a multipart MIME message/email to handle RTF formated text uisng C# and System.Net.Mail?

    I am new to this subject, so I appriciate if you could post the code for the same.

    Thanks

    • Moved by Cindy Meister MVP Wednesday, April 10, 2013 8:41 AM not vsto or office-related
    Wednesday, April 10, 2013 4:55 AM

Answers

All replies

  • RTF is not a standard MIME type. When you send an RTF message through Outlook, it encodes all MAPI specific properties (including PR_RTF_COMPRESSED) in a TNEF attachment (the infamous winmail.dat).

    TNEF format is documented, so you can create that attachment, but I would avoid that al any cost if I were you.

    Is there a particular reason why you need to send RTF instead of the standard HTML?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Wednesday, April 10, 2013 5:25 AM
  • Yes, there is requirement where I need to set RTF text as body of Email.

    If I set Email Body as RTF text like "{\rtf1\ansi\ansicpg1252\deff0\deflang1027{\fonttbl{\f0\fnil\fcharset0 Arial;}}\viewkind4\uc1\pard\qc\ul\b\fs24 Hello\ulnone\b0\par }, it will display text with RTF tags.

    I tried to create MIME message with content type as 'text\rtf'. This will create text attachment in email containing RTF text.

    Wednesday, April 10, 2013 7:08 AM
  • Hi,

    Please ask in the Visual C# Forum:

    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/threads

    Thanks,

    Zoli


    Wednesday, April 10, 2013 9:32 AM
  • Then TNEF is your only option... I would still try to change the RTF requirement. Why wouldn't HTML work? It would be easier to receive HTML and convert it to RTF if you want. What exactly depends on the message being RTF?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Wednesday, April 10, 2013 8:13 PM