Solved

How to save an outlook email in HTML format A360

  • 20 December 2023
  • 10 replies
  • 192 views

Badge +5

Hi all, I am trying to save the Outlook email using the save email action but it saves it as .msg/outlook item format. I want to save the Outlook email in HTML format but there is no format setting options available. Are there any actions available in the A360 that can use to save the email in HTML format?

icon

Best answer by Syed Zaman Akhtar 27 December 2023, 13:10

View original

10 replies

Userlevel 7
Badge +13

Hi @tayyabimtiaz1 ,

 

As there is not direct approach for this from A360 at the moment, you can try with inline scripts like Python or VBS.

 
Badge +5

Hi @tayyabimtiaz1 ,

 

As there is not direct approach for this from A360 at the moment, you can try with inline scripts like Python or VBS.

 

Can you share a python script for that purpose?

Userlevel 7
Badge +13

Hi @tayyabimtiaz1 ,

 

As there is not direct approach for this from A360 at the moment, you can try with inline scripts like Python or VBS.

 

Can you share a python script for that purpose?

You can refer this post on Stackoverflow regarding the same requirement. 

 
Userlevel 3
Badge +7

Hi @tayyabimtiaz1 ,

I think you should change your strategy a little. Rather then using the Python scripts or any other things, you can try below steps

  1. While looping through the mail in the mailbox, you can select message format as HTML.
  2. Assign the output the dictionary. The key will be “emailBody”.
  3. So, The dictionary variable with emailBody as the key will give you the content of each email in HTML format.
  4. This you can then use to log into the HTML file. Using “log text to file” action.
  5. In Log to file action you can mention the file path with extention as .html and pass the dictionary variable with key in “Enter text to log”.
  6. There you go. You’ll Have the email content as the HTML file.
Badge +5

Hi @tayyabimtiaz1 ,

I think you should change your strategy a little. Rather then using the Python scripts or any other things, you can try below steps

  1. While looping through the mail in the mailbox, you can select message format as HTML.
  2. Assign the output the dictionary. The key will be “emailBody”.
  3. So, The dictionary variable with emailBody as the key will give you the content of each email in HTML format.
  4. This you can then use to log into the HTML file. Using “log text to file” action.
  5. In Log to file action you can mention the file path with extention as .html and pass the dictionary variable with key in “Enter text to log”.
  6. There you go. You’ll Have the email content as the HTML file.

I have already used this approach this HTML can get too much data like CSS and other selectors etc. so that’s why I need another approach.

 Below is a sample how can i use that html and get the exact table with the structure.

 

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
    {font-family:"Cambria Math";
    panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
    {font-family:Calibri;
    panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
    {font-family:"Century Gothic";
    panose-1:2 11 5 2 2 2 2 2 2 4;}
@font-face
    {font-family:"Product Sans";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0in;
    font-size:11.0pt;
    font-family:"Calibri",sans-serif;}
span.EmailStyle18
    {mso-style-type:personal-reply;
    font-family:"Calibri",sans-serif;
    color:windowtext;}
.MsoChpDefault
    {mso-style-type:export-only;
    font-size:10.0pt;
    mso-ligatures:none;}
@page WordSection1
    {size:8.5in 11.0in;
    margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
    {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><table class=MsoNormalTable border=1 cellspacing=3 cellpadding=0><thead><tr><td style='padding:.75pt .75pt .75pt .75pt'></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>UBBE Number<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>Tracking Number<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>Pickup Number<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>Delivery Date<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>Delivery Time<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>Status<o:p></o:p></b></p></td></tr></thead><tr><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>0<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Ub0011<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Value1<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Delivered<o:p></o:p></p></td></tr><tr><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>1<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Ub0012<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Value12<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Value14<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Picked up<o:p></o:p></p></td></tr><tr><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>2<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Ub0013<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Value15<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>In transit<o:p></o:p></p></td></tr><tr><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>3<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Ub0014<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Delivery exception<o:p></o:p></p></td></tr></table><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal><span style='font-size:14.0pt;font-family:"Product Sans";color:#595959;mso-ligatures:standardcontextual'>Tayyab Imtiaz</span><span style='mso-ligatures:standardcontextual'><o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Product Sans";color:#669AD9;mso-ligatures:standardcontextual'>Senior Software Engineer</span><span style='mso-ligatures:standardcontextual'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:8.0pt;font-family:"Product Sans";color:black;mso-ligatures:standardcontextual'>+92 335 4222511</span><span style='mso-ligatures:standardcontextual'><o:p></o:p></span></p><p class=MsoNormal><b><span style='font-size:6.0pt;font-family:"Century Gothic",sans-serif;color:#669AD9;mso-ligatures:standardcontextual'>&nbsp;</span></b><span style='mso-ligatures:standardcontextual'><o:p></o:p></span></p><p class=MsoNormal style='text-indent:-7.1pt'><a href="http://www.tenx.ai/" title="http://www.tenx.ai/"><span style='font-size:12.0pt;font-family:"Product Sans";color:black;mso-fareast-language:EN-GB;text-decoration:none'><img border=0 width=136 height=50 style='width:1.4166in;height:.5208in' id="Picture_x0020_1" src="cid:image001.png@01DA3347.818CE4C0" alt="A picture containing font, graphics, logo, graphic design&#10;&#10;Description automatically generated"></span></a><span style='mso-ligatures:standardcontextual'><o:p></o:p></span></p><p class=MsoNormal style='text-indent:-7.1pt'><span style='font-size:7.0pt;font-family:"Product Sans";color:black;mso-ligatures:standardcontextual'>&nbsp;</span><span style='mso-ligatures:standardcontextual'><o:p></o:p></span></p><p class=MsoNormal><a href="http://www.facebook.com/analytics10x" title="http://www.facebook.com/analytics10x"><span style='font-size:9.0pt;color:black;mso-fareast-language:EN-GB;text-decoration:none'><img border=0 width=18 height=18 style='width:.1875in;height:.1875in' id="Picture_x0020_4" src="cid:image002.png@01DA3347.818CE4C0" alt=Image></span></a><span style='font-size:9.0pt;color:black;mso-ligatures:standardcontextual'>&nbsp;</span><a href="http://www.linkedin.com/company/analytics10x" title="http://www.linkedin.com/company/analytics10x"><span style='font-size:9.0pt;color:black;mso-fareast-language:EN-GB;text-decoration:none'><img border=0 width=18 height=18 style='width:.1875in;height:.1875in' id="Picture_x0020_8" src="cid:image003.png@01DA3347.818CE4C0" alt=Image></span></a><span style='font-size:9.0pt;color:black;mso-ligatures:standardcontextual'>&nbsp;</span><a href="http://www.twitter.com/analytics10x" title="http://www.twitter.com/analytics10x"><span style='font-size:9.0pt;color:black;mso-fareast-language:EN-GB;text-decoration:none'><img border=0 width=18 height=18 style='width:.1875in;height:.1875in' id="Picture_x0020_2" src="cid:image004.png@01DA3347.818CE4C0" alt=Image></span></a><span style='font-size:9.0pt;color:black;mso-ligatures:standardcontextual'>&nbsp;</span><a href="https://www.instagram.com/analytics10x/"><span style='font-size:9.0pt;color:black;mso-fareast-language:EN-GB;text-decoration:none'><img border=0 width=18 height=18 style='width:.1875in;height:.1875in' id="Picture_x0020_5" src="cid:image005.png@01DA3347.818CE4C0" alt=Image></span></a><span style='mso-ligatures:standardcontextual'><o:p></o:p></span></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b>From:</b> Muhammad Tayyab Imtiaz &lt;tayyab.imtiaz@tenx.ai&gt; <br><b>Sent:</b> Wednesday, December 20, 2023 1:19 PM<br><b>To:</b> Muhammad Tayyab Imtiaz &lt;tayyab.imtiaz@tenx.ai&gt;<br><b>Subject:</b> EMAIL HTML TABLE<o:p></o:p></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><table class=MsoNormalTable border=1 cellspacing=3 cellpadding=0><thead><tr><td style='padding:.75pt .75pt .75pt .75pt'></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>UBBE Number<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>Tracking Number<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>Pickup Number<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>Delivery Date<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>Delivery Time<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>Status<o:p></o:p></b></p></td></tr></thead><tr><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>0<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Ub0011<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Delivered<o:p></o:p></p></td></tr><tr><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>1<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Ub0012<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Picked up<o:p></o:p></p></td></tr><tr><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>2<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Ub0013<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>In transit<o:p></o:p></p></td></tr><tr><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal align=center style='text-align:center'><b>3<o:p></o:p></b></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Ub0014<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>NaN<o:p></o:p></p></td><td style='padding:.75pt .75pt .75pt .75pt'><p class=MsoNormal>Delivery exception<o:p></o:p></p></td></tr></table><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>

Badge +5

Hi @tayyabimtiaz1 ,

I think you should change your strategy a little. Rather then using the Python scripts or any other things, you can try below steps

  1. While looping through the mail in the mailbox, you can select message format as HTML.
  2. Assign the output the dictionary. The key will be “emailBody”.
  3. So, The dictionary variable with emailBody as the key will give you the content of each email in HTML format.
  4. This you can then use to log into the HTML file. Using “log text to file” action.
  5. In Log to file action you can mention the file path with extention as .html and pass the dictionary variable with key in “Enter text to log”.
  6. There you go. You’ll Have the email content as the HTML file.

In that way, i am getting the complete HTML and css selector whole pattern so thats why it is difficult to handle that case.

Badge +5

Hi @tayyabimtiaz1 ,

I think you should change your strategy a little. Rather then using the Python scripts or any other things, you can try below steps

  1. While looping through the mail in the mailbox, you can select message format as HTML.
  2. Assign the output the dictionary. The key will be “emailBody”.
  3. So, The dictionary variable with emailBody as the key will give you the content of each email in HTML format.
  4. This you can then use to log into the HTML file. Using “log text to file” action.
  5. In Log to file action you can mention the file path with extention as .html and pass the dictionary variable with key in “Enter text to log”.
  6. There you go. You’ll Have the email content as the HTML file.

I have attached a file that contains 3 emails HTML which I get by using your approach how can i get the tables from those HTML values?

Userlevel 3
Badge +7

@tayyabimtiaz1 ,

Here you go.

 

Remember, You selected HTML. That means the file where you will be logging it needs to be of (.html) extension or format. and not (.txt). If you want text then select “Plain Text” in the loop action. I think you wanted HTML file for your emails as per the question. So this will be the best way Rather downloading as .eml or .msg and then changing it to .html

Badge +3

Hi tayyabimtiaz1,
 

To ensure efficient and precise responses to your inquiries, I recommend clearly stating the objective of your question. This approach will provide a solid reference point, enabling the developers to offer more targeted and relevant answers.

From what I understand, your goal is to extract a table from the body of an email, correct?

Instead, you can save the email content in HTML format with a .html extension.

Using the dictionary variable 
Key is emailMessage
 


Use log to file to save the data in txt and covert it in .html.

After saving, you can easily access this HTML file using the 'Open Application' command in your development environment. For capturing the table data, the “Recorder Package”.

Let me know if this aligns with your requirements or if you need further assistance.

Badge +3

There is another way also if you want to try DLLs
 

You can use the Outlook DLL wrapper which will directly save the email in HTML file.

Reply