SRoyi
January 30, 2024, 9:29am
1
Hi all,
I am currently trying to paste an image into my email body.
The way I retrieve my image is through data scraping from a webpage.
This is the data of the retrieved images:
Then, I save it into a variable, type UiPath.Core.Image
How could I use the so that the variable will paste an image inside of my email body?
Thanks
vrdabberu
(Varunraj Dabberu)
January 30, 2024, 9:30am
2
HI @SRoyi
Please check the below thread:
Regards
1 Like
ppr
(Peter Preuss)
January 30, 2024, 9:32am
4
Is one image as an embedded Image to place within the email body?
OR
are all images to add as attachments?
SRoyi
January 30, 2024, 1:36pm
5
Only 1 Image will be added
ppr
(Peter Preuss)
January 30, 2024, 1:43pm
6
ok, perfect
When we dont want to use the img src url directly.
we can do
ImageAsB64String =
Convert.ToBase64String(File.ReadAllBytes(myLocalResource.LocalPath))
OR
with HttpClient Download
myHttpClient = new HttpClient()
myBytes | Byte Array =
myHttpClient.GetByteArrayAsync(strURL).Result
ImageAsB64String2 =
Convert.ToBase64String(myBytes)
Then we configure a HTML template as described here:
give a try at:
strFilePath = FullFilePathToTheImage
Assign Activity:
strB64 = Convert.ToBase64String(File.ReadAllBytes(strFilePath))
Keep in mind:
strB64 is only the part:
[grafik]
the red part you would handle e.g. by prepending or within the html part
It can fail, when done this the first time. But just focus on the correct red handle part, then it it will work
E.g.:
<P><IMG src="data:image/png;base64,{{YourMapVariable}}"></P>
1 Like
system
(system)
Closed
February 2, 2024, 1:44pm
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.