We are facing an issue with appending an existing email content to New mail message object when existing Email file was created or send as Plain Text format. Actually the while debug the existingEmail object has its own entire body content and when it was send to create a new MapiMessge with reference to New Mail message object the output returns with only additional contents and original existing email content got disappeared for Plain Text. Could you please support us on this how to resolve it.
The following code we have used
newMailMessage.IsBodyHtml = existingMailMessage.IsBodyHtml;
if (newMailMessage.IsBodyHtml)
newMailMessage.HtmlBody = existingMailMessage.HtmlBody + “<p style=“margin:0em;”>” + System.Web.HttpUtility.HtmlEncode(bodyTags).Replace("\r\n", “
else
newMailMessage.Body = existingMailMessage.Body + bodyTags; // bodyTags string builder used to append customized content with existing email content
using (MapiMessage mapiMessage = MapiMessage.FromMailMessage(newMailMessage))
{
// set draft status mapiMessage.SetMessageFlags(MapiMessageFlags.MSGFLAG_UNSENT);
fileReference = Guid.NewGuid().ToString() + “.msg”;
mapiMessage.Save(saveEmailDoc);
}