none
Appending body using put_body() for RTF messages is moving the attachments to the end of the email. RRS feed

  • Question

  • Hi,

    I need to append strings for Rich Text emails. I am getting notification when user clicks on send button. I am getting events for Outlook::Applications. When I get the notifications, I am using Outlook::_MailItems and using put_body() method to append the strings. But, this is changing the positions of attachments added. I tried using put_position() but it didn't work. Is there any other way so that attachments are not pushed to end of the body?

    Thanks in advance.

    Thursday, October 5, 2017 6:37 PM

All replies

  • Worse than that, setting the plain text Body property will also wipe out all the formatting both for the HTML and RTF messages.

    You need to set the HTMLBody or RtfBody properties (depending on the message format). Note that in both cases old and new data cannot be concatenated, they must be merged.


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

    Thursday, October 5, 2017 6:47 PM
  • Hi Dmitry,

    Thanks. If I use put_HTMLBody(), then it changes the body format to HTML, which would be a problem like, there is a mail option in Outlook. File->Options->Mail and Message Format. There we can select "When sedning message ,Convert Rich Text to Rich Text". This setting will be overridden if I use put_HTMLBody().

    Thursday, October 5, 2017 7:14 PM
  • You need to use HTMLBody or RtfBody depending on the value of the BodyFormat property.

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

    Thursday, October 5, 2017 7:46 PM