cancel
Showing results for 
Search instead for 
Did you mean: 

Send HTML Content as in Outlook Mail

KummariSrikanth
Level 4

Hi,

How to send html content as body  in outlook mail.

Thank You..



------------------------------
Kummari Srikanth
------------------------------
6 REPLIES 6

Mukeshh_k
MVP

Hi Kummari Srikanth : Refer this thread : https://community.blueprism.com/discussion/format-the-body-of-outlook-email. Additionally do let me know if you face any difficulties and what exactly you want to send as part of HTML in your emails?



------------------------------
Kindly up vote this as "Best Answer" if it adds value or resolves your query in anyway possible, happy to help.

Regards,

Mukesh Kumar - Senior Automation Developer

NHS England, United Kingdom, GB
------------------------------
Regards,

Mukesh Kumar

Mukeshh_k
MVP

Also for creating a HTML Table from a collection which is the main requirement for many- Create a custom MS Outlook HTML VBO and follow below steps: 

  1. Initialise > Code Options > Ensure Dll and NameSpaces are listed:
    21062.png
  2. Add an action page: Send an email with HTML Table: for your reference I have kept the send email & collection count in the action itself but it should be done via process before after receiving the necessary details. 21063.png
  3. . Add Inputs: As you can see in the above snippet : For local Variables : Style - you can add or customise as per your choice : <style type="text/css">
    body, table, td {font-family: Arial, Helvetica, sans-serif !important;  font-size: 10pt;} 
    body {font-family: Arial, sans-serif !important;};
    </style>21064.png
  4. Add 1st Code Stage with Necessary Inputs: Append HTML Tags: Code: TextAbove=TextAbove.Replace(System.Environment.NewLine,"<br />");
    TextBelow=TextBelow.Replace(System.Environment.NewLine,"<br />");
    TextAbove="<html><body>"+Style+TextAbove;
    TextBelow=TextBelow+"</body></html>";
    TAbove=TextAbove;
    TBelow=TextBelow;21066.png21067.png21068.png
  5. Check Collection Count and decide whether to create an HTML table if only collection row count is greater than 0 as in the snippet above
  6. Create 2nd Code stage for HTML Table with Inputs as Data Table(your collection)21069.png21070.png
  7. Code: 21071.png 

    if(dtable !=null)
    {
    System.Text.StringBuilder strHTMLBuilder = new System.Text.StringBuilder();
    strHTMLBuilder.Append("<br /><br />");

    strHTMLBuilder.Append("<table rules='all' bordercolor='#4d4c4d' border='1' bgcolor='#FFFFFF' cellpadding='5'>");

    if (Include_Header)
    {
    strHTMLBuilder.Append("<tr>");  
    foreach (DataColumn myColumn in dtable.Columns)  
    {  
    strHTMLBuilder.Append("<td width='20%'>");  
    strHTMLBuilder.Append(myColumn.ColumnName);  
    strHTMLBuilder.Append("</td>");  
      
    }  
    strHTMLBuilder.Append("</tr>");  
    }

      
    foreach (DataRow myRow in dtable.Rows)  
    {  
      
    strHTMLBuilder.Append("<tr >");  
    foreach (DataColumn myColumn in dtable.Columns)  
    {  
    strHTMLBuilder.Append("<td width='20%'>");  
    strHTMLBuilder.Append(myRow[myColumn.ColumnName].ToString());  
    strHTMLBuilder.Append("</td>");  
      
    }  
    strHTMLBuilder.Append("</tr>");  
    }  
      
    //Close tags.  
    strHTMLBuilder.Append("</table>");
    strHTMLBuilder.Append("<br /><br />");
      
    string Htmltext = strHTMLBuilder.ToString();  
    Htmltext1=Htmltext;
    }
    else
    {
        Htmltext1="";
    }

  8. Send the HTML Connect in the body by concatenating your output from the above code:21072.png

 let me know if you face any difficulties implementing this.



------------------------------
Kindly up vote this as "Best Answer" if it adds value or resolves your query in anyway possible, happy to help.

Regards,

Mukesh Kumar - Senior Automation Developer

NHS England, United Kingdom, GB
------------------------------
Regards,

Mukesh Kumar

Hi Mukesh Kumar,

Refer to this thread: https://community.blueprism.com/discussion/format-the-body-of-outlook-email. This page is showing an Error. I am trying the below code.If any issue I will let you know.

21088.png
Thank & regards
Srikanth K


------------------------------
Kummari Srikanth
------------------------------

Mukeshh_k
MVP

Hi  Kummari Srikanth :Try this link as it will help you to understand your query more: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwjuzPXAq4P-AhWRWcAKHeD-C80QFnoECAkQAQ&url=https%3A%2F%2Fcommunity.blueprism.com%2Fdiscussion%2Fformat-the-body-o...



------------------------------
Kindly up vote this as "Best Answer" if it adds value or resolves your query in anyway possible, happy to help.

Regards,

Mukesh Kumar - Senior Automation Developer

NHS England, United Kingdom, GB
------------------------------
Regards,

Mukesh Kumar

Hi Mukesh Kumar,

Here the main problem is to add a logo which is in the PNG format at the top right corner in the outlook mail body  by using Html Code in the blue prism.

Regards & Thanks,

Srikanth 



------------------------------
Kummari Srikanth
------------------------------

Hi Srikanth

Can you insert this code "<div style="position: absolute; top: 0; right: 0;">
  <img src="your-image.png" alt="Your Image" width="32" height="32">
</div>"
your-image.png >> Source , Your Image >> is description if required or you can remove
Based on requirement you can resize the image and mention the position as trial and error
and also attach the Image otherwise the recipient will not get

Hope this helps you

Regards  



------------------------------
Lakshmi Narayana
------------------------------