Format the body of outlook email.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-02-23 11:24 AM
I have just wanted to ask; if there is any way to format the long text of the body when I send it using
MS Outlook Email VBO::Send Email.
------------------------------
Saja Ismael
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-02-23 12:05 PM
While we do not have any formatting requirements, our emails do tend to have links as URL's and file locations that we need to be clickable by the recipient. Enclosing the URL or link in < and > will do that for you.
------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
Paul, Sweden
(By all means, do not mark this as the best answer!)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-02-23 12:52 PM
------------------------------
Saja Ismael
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-02-23 01:08 PM
-----------------------------------
"Hi!" & NewLine() & NewLine() &
"text1 text1 text1 text1" & NewLine() &
"text2 text2 text2 text2" & NewLine() & NewLine() &
"Kind regards," & NewLine() &
"Saja Ismael"
-----------------------------------
which would result in:
-----------------------------------
Hi!
text1 text1 text1 text1
text2 text2 text2 text2
Kind regards,
Saja Ismael
-----------------------------------
Then you have the data item as input for your Send Email action.
------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
Paul, Sweden
(By all means, do not mark this as the best answer!)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-02-23 01:11 PM
------------------------------
Happy coding!
---------------
Paul
Sweden
------------------------------
Paul, Sweden
(By all means, do not mark this as the best answer!)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-02-23 01:50 PM
<BR> is used to add a new line
Our mail body template for sending exceptions :
"<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<style>
table {border: 2px solid black; border-collapse: collapse; padding: 5px;}
th {border: 1px solid black; border-collapse: collapse; padding: 5px; text-align: left; vertical-align: text-top; background-color: #92d050;}
td {border: 1px solid black; border-collapse: collapse; padding: 5px; text-align: left; vertical-align: text-top;}
</style>
</head>
<body>
<p> The process stopped due to an exception, find more information below
<BR>
<BR> Kinds regards
<BR> Your favorite Robot !
</p>
<table style='width: 100.0%'><tbody>
<tr>
<td style='width: 20%'><p><strong>Exception Type</strong></p></td>
<td style='width: 80%'><p>"& ExceptionType() &"</p></td>
</tr>
<tr>
<td style='width: 20%'><p><strong>Exception Stage</strong></p></td>
<td style='width: 80%'><p>"& ExceptionStage() &"</p></td>
</tr>
<tr>
<td style='width: 20%'><p><strong>Exception Detail</strong></p></td>
<td style='width: 80%'><p>"& ExceptionDetail() &"</p></td>
</tr>
</tbody></table>
</body>
<footer>
<p>
<font color='#009900' face='Webdings' size='4'>P</font>
<font color='#009900' face='verdana,arial,helvetica' size='2'>Please consider the environment before printing this email.</font>
</p>
</footer>
</html>"
If you use a formatted text field you have to replace the NexLine() to <BR> :
<p>"& Replace( [Text]; NewLine(); "<BR>") &" </p>
If you want to insert a link to a file:
<p><a href='file:///" & [ScreenshotPath] & "'>Screenshot</a></p>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-02-23 01:53 PM
Learned about that in a PoC we did about 4 years ago.
With that said, one is able to also build that HTML dynamically in terms of Table Rows, etc., which can be very useful.
Happy to send examples if that's helpful.
------------------------------
Kevin Wilson
`Solution Engineer
Blueprism
America/Denver
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-02-23 10:07 AM
I was looking exactly to build HTML dynamically email body in terms of Table Rows... can you send some examples?
Thanks in advance.
António
------------------------------
Antonio Melo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-02-23 01:49 PM
here is a tiny snippet I wrote in C# to convert a DataTable into an HTML table:
Input Argument being 'inCollection' (as Collection of Strings) and Output Argument being 'outHTML' as a text Data Item.
outHTML = "<table>";
//add header row
outHTML += "<tr>";
for(int i=0;i<inCollection.Columns.Count;i++)
outHTML+="<td>"+inCollection.Columns.ColumnName+"</td>";
outHTML += "</tr>";
//add rows
for (int i = 0; i < inCollection.Rows.Count; i++)
{
outHTML += "<tr>";
for (int j = 0; j< inCollection.Columns.Count; j++)
outHTML += "<td>" + inCollection.Rows[j].ToString() + "</td>";
outHTML += "</tr>";
}
outHTML += "</table>";
------------------------------
Ramón Requena López
RPA Developer
Magenta Telekom
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-02-23 03:43 PM
Thanks for your reply. I was wondering if you had implemented some call to a template engine like https://shopify.github.io/liquid
Maybe compile it to an dll and include in global code functions.
So we can have a file template, the collection with data, and merge them into final HTML with an template engine.
This way I can change the email body, without changing the RPA code.
Thanks,
António
------------------------------
Antonio Melo
------------------------------
