0

Here is my image tag :

string target = "http://localhost:8699/setup/getcompanysignature?companyId="+CompanyId;
string image = "<img src='"+target+"'alt='LogoImage'title='logoImage'style='display:block'width='50'height='70'>"

Gmail is returning 404 in the console and is not loading image in email body but the image src URL is working fine and is returning image.

here is what I tried:

  1. Changed image settings in Gmail
  2. cleared cache
  3. changed image type from jpeg to png
  4. applied height, width, and title attributes
  5. made sure that there are no spaces in the URL.
  6. and all that as suggested in the following:

But still, my issue is not resolved. One thing I am not sure about is that google gets images from trusted sources and secured URLs. If it is, then how can I test my code on localhost? Any kind of help will be appreciated.

Ali Hamza
  • 21
  • 5
  • You should really be including the image as an inline attachment, then there is no need to have the server involved with displaying the image. – Neil Aug 10 '21 at 08:35
  • Hey Neil ,i need a server because the image is returned by method (getcompanysignature) which gets base64 data from db using companyId, converts, and returns the image.So that's why i included it. – Ali Hamza Aug 10 '21 at 08:44
  • Check this https://stackoverflow.com/questions/20836911/images-not-displayed-for-gmail – Akshay G Aug 10 '21 at 08:49
  • @ Akshay, I already checked this but of no use. – Ali Hamza Aug 10 '21 at 09:05
  • yeah but ... if the email is on googles server wouldn't localhost then be googles server? How do you think this would work? – Linda Lawton - DaImTo Aug 10 '21 at 11:45
  • What is your question exactly? How to get localhost image showing on Gmail (impossible)? Or how to get an image showing on Gmail at all? – Nathan Aug 11 '21 at 01:18
  • I was trying to load image from localhost in gmail. But now, I got the point that gmail doesn't load images from localhost and untrustable resources. Thanks. – Ali Hamza Aug 11 '21 at 09:19

0 Answers0