How to get original incoming email body format while forwarding outlook mail to another mailbox

I’m trying to add some text into mail body, while modifying the body text, the original format of body is losing, I need original format of email body, how to get original format, can any one help me,

we don’t know exact format, what we get in email body, it may contains table or any other structured data, if we pick out body text , the original format will lose,

in case there is a table in email body, if we pick the body text, the table data will get messy & got unstructured data, I need to maintain table as it is & need to my data into email body

Hi @Mohammad_Gouse ,

The following approach will help you,

Step 1. Create an HTML template as in the inline screenshot with place holders to replace value.
Step 2: Read the HTML template text file and assign the value to string variable.
Step 3: Replace the All HTML Body specific placeholders with actual values as in the inline screenshot.

Thank you.

Hi @Mohammad_Gouse ,

There are multiple ways you can do it. Lets stick to basic way of doing it.

As shown in screenshot provide text with html tags
is used to break line.
and also check “IsBodyHTML”

Give a try.

This is how you can see output.

image

Dear @Jobin_Joy, Thanks for your response,
I’m modifying the another mail which we received from another user & also we don’t know what’s the exact format of email body, we have to keep existing format as it is & we need to add some text into the body

@Mohammad_Gouse

If needed, you can make use of the below attached HTML template of mine.
Email Template.txt (1.6 KB)

Please mark the issue as ‘Resolved’ if this helps. Thank you.

1 Like

Thanks for providing Template,

But your template can’t resolve my issue,

The Template which I given doesn’t have any table to render the data. I shared the template file to get an idea on how dynamic values are placed in an html body while sending an email.

Dear @Jobin_Joy

I will explain you clearly, what’s my requirement is

I will recieve mails from customer’s regard complaints, so I need to forward that emails to customer care on doing some validations , ok, when I’m forwarding customer mail to customer care, the body doesn’t contain from & ccaddress in the body, so customer care can’t know from which customer, mail has been received, so what I’m doing is ,I’m modifying the customer email body by adding from & Ccaddress in it & forwarding the mail to customer care while forwarding the mail, I lost the original format of the customer mail body, without losing mail body format we have to forward the mails to customer care,

The above is the my requirement,
So we don’t need to maintain any template, we are going to Modify the existing customer mail body & forward it to customer care,

If you know how to maintain original format of received email body, pls let me know.

give a try on exploring the Property: BodyAsHtml

And also:

Hi @Mohammad_Gouse,

Thanks for the detailed information.

You can do this in couple of ways.

Way 1: Extract the original email body and append it with the text you want (in your case From and CC email address). Finally send out an email to customer care with append email body text. In this case append should be happening at the end of existing text.
Refer the below inline screenshots.

Way 2: Find a keyword(which present in every email body) and replace it with "that keyword + text you want append (From & CC email address).

Ex:
Keyword: Policy#
Text to replace with original email body keyword should be “Policy#”+“From & CC information”

Ex: OrignialEmailBody.Replace(Keyword,Keyword+TextToAppend).ToString

Note: If you are expecting the final should be well formatted then you should have to rely on HTML template. In such case the concept should be as in my previous post (How to get original incoming email body format while forwarding outlook mail to another mailbox - #2 by Jobin_Joy).
Simply place some placeholder keyword in the HTML template and replace it with actual text you want.

Screenshots for Way 1:




Hope this will help you. Thank you.