Help add canvas drawing as HTML image on email

Hi,

I need to send on an email the users signature obtained via canvas component, I'm able to send a text email successfully, but when I try to send the image from the canvas as HTML all I get is the path, I need the actual image.

This is what I get on my email:

Load 3
Lot gh453
Pounds 125

file:///storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/MyPlanPic.jpg

These are my blocks:

I'm using the com.sunny.SmtpClient.aix extension.

Any samples would be greatly appreciated.

Kind regards

Send image as an attachment ?

Convert image to base64, and send this in the body as an <img> element in your body, as a datauri - data:img/jpeg;base64,sdlkfsdfl.....(not tested, might work)

Save your image to the shared Android directory 'Pictures' using 'File' (Not TinyDB!), or convert it directly to Base64

HI,

I've tried using html code, but now I get this in my email

image

My blocks:

What do you think?

Regards

Your path to the file is probably incorrect (only showing file name?)

What is the value of tag MyPlanPic ?

This is the value of the Tag:

image

You are saving a path to the image in TinyDB (should be saved to the 'ASD' or 'Pictures'). TinyDB not required.

What does the extension say about including images? Does it actually want a path or should the image be encoded to Base64? I think most likely Base64, as suggested by Tim.

I've changed to trying to save using ASD to save the image file:

And in the send email procedure

But when I check the SD Card, no image is saved in the specified path.

Also I can't find any documentation for this extension on how to send html images.

please help

You will have to add pass attachments as list in parameter attachments.
Since you are sending mail as html so you need to convert image to base64 and follow above posts.
I'll try to prepare an example as soon as possible.

Hi,

Thank you very much, really appreciate if you could share an example, I've been stuck for 2 days, and it's very frustrating.

Really good job!

Kind regards

Unfortunately, it is not possible to attach encoded images with mail.
Though, you can attach them as separate.

Do you mean send image as base64 in an html email is not possible ?

Yes, not possible with SmtpClient extension.

1 Like

You could always upload the image to google drive, get the link, and post that in the body of your email ?

Or

Send Email using Google Apps Script

if you are happy with sending all emails from one account (note the quotas...)

Why is that @vknow360 - because it's a very long string?

Hi,

Thank you TIMA12, vknow360, ChrisWard for all your help,

I will try both options the script and to upload the image online and let you know the results.

Kind regards

Did you found the solution for that old topic?