How to add pic in the email content

286 views
Skip to first unread message

Poonam Shrivastava

unread,
Aug 19, 2022, 2:53:49 AM8/19/22
to Google Apps Script Community
Hi ,

I am trying to add 2 pics in the email script.

Pic not to be sent as attachment but to be displayed in the email content.

Please suggest how to achieve this?  

Thanks & Regards,

Poonam Shrivastava

Ben Ronkin

unread,
Aug 26, 2022, 10:59:01 PM8/26/22
to Google Apps Script Community
Try this:

1. Host the images on your Google Drive
2. Set the image sharing to anyone with a link as a viewer
3. Copy the image URL
4. Add an image tag <img> to the body of your email.
5. Paste your image URL in the image src attribute.

Ben

CBMServices Web

unread,
Aug 26, 2022, 11:42:51 PM8/26/22
to google-apps-sc...@googlegroups.com
The URL of the picture is not enough because it expects to be opened by the Google Picture viewer. What is needed is the downloadURL of the image.

You can get the downloadURL programmatically by using DriveApp, getting the file by ID and then using getDownloadURL method on it.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/0a1eb234-1775-4e07-85e2-4441f3458e52n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages