Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Embedded image showing broken link

Hello, I am trying to embed a PNG image from a Cloud Storage bucket into an email using cloud functions. My problem is that the image shows a broken link once the email is received. However, if instead of sourcing the image from Cloud Storage I use URLs from Imgbb, the image shows correctly. This is how I’m adding the URL in the html body:

email_with_image = f'<img src="{image_url}"/><br>{content}'

image_url is good because if I print the resulting URL and paste it in the browser it shows me the image.

The bucket containing my images is publicly available, where allUsers have permissions for Storage Object Viewer. 

What can I be possibly doing wrong? I’ve tried many different options, but it is just not working.

I appreciate your help, thank you.

0 1 1,415
1 REPLY 1

Hi @Jterzaga,

Welcome to the Google Cloud Community!

You can try the following troubleshooting options:

  1. Make sure that the image you are sending is not above the size limit. Outlook allows sending up to 20MB while other email services allow sending up to 25MB. 
  2. Try sending your image to a different email. Some email clients may have security settings that prevent them from seeing the sent images, especially when they are sourced from an external URL. You can also check your email's settings.
  3. Make sure that you are using the correct link. If the image is publicly available, you should be able to access it here: https://storage.googleapis.com/BUCKET_NAME/OBJECT_NAME. You can also read more about Accessing Public Data.
  4. You can also get in touch with Google Cloud Support if the above options don't work.

Let me know if it helped, thanks!