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’?
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)
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.