Embedded image as linked resource is sent as attachment when too big

Hey folks, referencing to this post, I’m using the attached xaml to send embedded images as a linked resource. When I send a small image, it works perfectly. However, when I try to send a larger one, it sends the image as attachment instead.

Is there a way to instead send the larger one as an embedded image? I was thinking maybe I should resize it instead, or put in some delay in case the embedding part needs more time, and will fail when ‘rushed’?

Any inputs would be greatly appreciated. Thanks!

LinkedResourceEmbedded.xaml (24.7 KB)

Hello @earldantedumayag

Can i know the size of picture that you send with embedded?

as i tested with size 918KB image still loading fine without delay.
Note : Test with Gmail SMTP(Personal)

Hi @earldantedumayag

The size of an image can affect whether it can be embedded in an email or not. Many email clients have size limits on attachments, including embedded images. If the image is too large, it may exceed these limits and cause the email to fail to send.

In addition, embedding a large image can also result in the email taking longer to send or to be received by the recipient. This can be especially problematic if the recipient has a slow internet connection or is accessing their email on a mobile device.

This below code will resize the image to 100x100 pixels and save it to a file. You can adjust the size as needed by changing the dimensions of the resizedImage object.

Dim image As New Bitmap(“C:\Path\To\My\Image.jpg”)
Dim resizedImage As New Bitmap(100, 100)
Dim g As Graphics = Graphics.FromImage(resizedImage)
g.DrawImage(image, New Rectangle(0, 0, resizedImage.Width, resizedImage.Height))
resizedImage.Save(“C:\Path\To\My\Resized\Image.jpg”, ImageFormat.Jpeg)

Cheers @earldantedumayag

1 Like

@earldantedumayag

Did you try using create html content activity? And using the output in the mail?

Cheers

Weird. Mine is smaller, though I use a corporate domain account. Is there something I need to check on this?

I’ll try to do this. Thanks! Do I use an invoke code activity? Pretty noob on this.

1 Like

There might be limited size for some SMTP provider but i’m not sure about regular size limit

I have attached my workflow that use for sending embedded image, in case if you want to study it
Main.xaml (9.5 KB)

when downloaded please change setting as i highlighted in screenshot below


Hope this workflow can help you,
Best Regard,

Exactly
Have a view on this doc on how to use INVOKE CODE activity

https://docs.uipath.com/activities/docs/invoke-code

Cheers @earldantedumayag

Hey guys, thanks for all the help. Not sure why, but it eventually was fixed. What I did was to put the image generated on the project’s root folder and ensure that there’s no space in its name. With that, it was able to send the big chart.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.