CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2007
    Posts
    42

    Unhappy Send mails with rtf format using smtp client

    Hi,
    I am developing a tool to send mail. I need that the user can send the mail with the body text in RTF format. Therefore the user can write and edit the body text and when he want push the send button and the mail is sended correctly.

    I have developed this tool using mapiex and works fine, the reciver get the mail and can see the body in RTF format.
    Now I need do the same using SMTP Client, System::Net::Mail (http://msdn.microsoft.com/en-us/libr...mtpclient.aspx), I send the mail but I don't know send mail with body in rtf format. The recivier always get the mail with the body text in text plain format. How I can do to send mails with body in RTF formats using SMTP Client?

    I have tried to add alternatvies view, for example:

    ////////////////////////////////////////////////////////////////////
    MailMessage *mmsgMailMsg = new MailMessage();
    mmsgMailMsg->From = maAdressFrom;
    ...
    mmsgMailMsg->Body = sMessage.Trim();


    AlternateView *altViewRTF = AlternateView::CreateAlternateViewFromString(m_sBodyRTFText.Trim(),Encoding::ASCII,MediaTypeNames::Text::RichText);
    mmsgMailMsg->AlternateViews->Add(altViewRTF);
    ...
    ////////////////////////////////////////////////////

    I have checked the mail that recivie the outlook clients and always the body text is in plain text. If I check other clients I can see the same. In other clients I can see that the body in rtf format is attached to mail (I don't want this).

    Can any help me please?

    pd: I have searched a lot of webs to solve this issue but I don't get solve my issue, for example: http://social.msdn.microsoft.com/for...1-698f67a42321

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: Send mails with rtf format using smtp client

    It's obviously C++/CLI that you're using there, not native C++, and this is discussed in a separate section: http://www.codeguru.com/forum/forumdisplay.php?f=17. I already have investigated your problem a bit and it seems to demand a rather in-depth discussion. As I don't want to post that much off-topic stuff here, I suggest you start another thread on your topic over there in the C++/CLI section and I'll reply there.

    BTW, the syntax you're using puzzles me a bit... Should'nt this

    Code:
    MailMessage *mmsgMailMsg = new MailMessage();
    rather be

    Code:
    MailMessage ^mmsgMailMsg = gcnew MailMessage();
    ? I doubt it even would compile the way you posted it.

    And please use code tags when posting code. They will make the code much better readable.
    Last edited by Eri523; May 24th, 2011 at 12:46 PM.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Feb 2007
    Posts
    42

    Re: Send mails with rtf format using smtp client

    Ok, thank you very much for your reply, I have started a new topic in the section that you have told me. Thanks.

    The code that I have pasted compile fine because we have defined in the properties of our managed project this property:
    Common Language Runtime Support, Old Syntax (/clr: oldSyntax)

    We use old sintaxi: http://msdn.microsoft.com/en-us/libr...(v=vs.80).aspx

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured