Image not display in Newsletters - aem

I am sending the newsletter to the target leads via day CQ mail service in CQ5, My newsletter template contains an image from DAM (via drap/drop). My Newsletter sent successfully to the audience but image not getting display. Below is the img src generate once i receive the newsletter.
<img title="logo" alt="logo" src="https://ci3.googleusercontent.com/proxy/dBvtBcRC6SpELT7-2A_TARSjSJ3t7HDuxtIKWk-QoU7yCISyVeR1JledcIr6oleEkY2SxBZgJwGsjeDn8VQA653Omj_MQHScJgbZ-kKwiC6YHNsfeE2dS8tErqhQKvQIG8Y5MGk3MJhHdyzAydO5JZNxUxvAjNlCVTXjOpyoC2J-K-062Ec8aaT-UpkinvASKg=s0-d-e1-ft#http://localhost:4502/content/campaigns/myApp/Newsletter/Monthly-Newsletter/_jcr_content/header.img.png/1427268772034.png" class="CToWUd">
Any Idea how to resolve it.
Thanks

Gmail does not directly link to the image , they use proxies. From the img src you have posted the image link is
http://localhost:4502/content/campaigns/myApp/Newsletter/Monthly-Newsletter....
Since google's server can't reach your local instance the image is not being displayed.
References :
https://filippo.io/how-the-new-gmail-image-proxy-works-and-what-does-this-mean-for-you/
https://support.google.com/a/answer/3299041?hl=en

Related

HTML Email: What is this IMG tag doing in the preheader?

I'm relatively new to HTML Email Development, and I'm trying to improve my understanding of HTML Email structures by dissecting HTML Emails on "reallygoodemails.com."
On the example located at this address: "https://reallygoodemails.com/emails/craving-some-chocolate/live" , there is an IMG tag located on line "502" directly after the body tag in the preheader section of the HTML Email.
What does this IMG tag do?
It's a Spy Pixel.
Spy pixels or tracker pixels are hyperlinks to remote image files in HTML email messages that have the effect of spying on the person reading the email if the image is downloaded. They are commonly embedded in the HTML of an email as small, imperceptible, transparent graphic files. Spy pixels are commonly used in marketing, and there are several countermeasures in place that aim to block email tracking pixels. However, there are few regulations in place that effectively guard against email tracking approaches.
To summarize, when the email is opened and the browser loads that image, the browser will look up that URL expecting image data. However, the image data is 0 pixels by 0 pixels, so the email doesn't display anything. Instead, the server hosting that "image" knows you opened the email. Because the URL is unique to your email address, they know that you personally opened the email. That information is useful for showing the sender how their email marketing campaign is performing.

How to display images within html email content in gmail?

In yahoomail and html email, the images are loading but not in gmail. I observed that in gmail, the image urls are altered.
For example,
Image URL in yahoo/Hotmail : http://qaecmwcs.qacorp.moneygram.com/sites/Satellite?blobcol=urldata&blobkey=id&blobnocache=true&blobtable=MungoBlobs&blobwhere=1515690635784&ssbinary=true
Url for the same image in Gmail : https://ci5.googleusercontent.com/proxy/2B2Fyk0aboH-eiikaxVWdIC9DXbJzhZEuWKm5yPwUeXf3SdYRuoKBGT-HeCFRlNcg7VTzljtSsEhHkikFMGPac35C6Az2Fc2wsdig3xj0S3g1bEIABaMx9RKnTjYuqagP1hUGNl3GG4f2aHy26wHrINZkdn5Wv3y6zcvbWHUL8rabUcjHuCO05i8RM31x8iFJmUorccqIJM6P9f6-eLIaQ5GpZYCrKPJws72HfM2-AsXcg=s0-d-e1-ft#http://qaecmwcs.qacorp.moneygram.com/sites/Satellite?blobcol=urldata&blobkey=id&blobnocache=true&blobtable=MungoBlobs&blobwhere=1515690635784&ssbinary=true
When I manually remove the additional url part in the image src,from DevTools then I am able to see the image. Can any one please let me know how I can handle this in gmail?
If you want an image to work in email, it has to be viewable by your audience. The image path should be straightforward and simple. What you have posted over and over in your questions are images that are not accessible to the general public, so they will never work for an email.
Image Path
This is how an image should be formatted:
<img src="staticpath" alt="imagename" class="imageclass" />
<img src="https://www.w3schools.com/images/w3schools_green.jpg" width="104" height="142" alt="W3Schools.com">
<img src="https://placehold.it/600x600" height="600" width="600" />
More information:
https://www.w3schools.com/html/html_images.asp
Image Descriptors
As a best practice, an image path should end in a descriptor that defines what the format of the image. Images that work well with emails include .jpg .png .gif.
More Information:
https://litmus.com/blog/png-gif-or-jpeg-which-ones-should-you-use-in-email
Email Templates
Your email templates should follow the basic practices of a well-formatted html page. Email development is not Web development because email clients do not support current html 5 or css 3 standards. So it can be very hit and miss to create a complex email.
The following email templates will give you a good idea how an email should be created, how images should look, how image classes work.
Email template Examples:
http://tedgoas.github.io/Cerberus/
https://foundation.zurb.com/emails/docs/v1.0.5/index.html
Please take the time to read through this answer, read through the attached examples.
Best Practices & Considerations when writing HTML Emails
Good luck with your images.
The firewall was blocking the images from displaying. When client opened the firewall then the images within the server are loaded.

How to Include image in email using sails email hook

Sails version: 0.12.14
sails-hook-email: 0.12.1
I am trying to send image in the email so that I can show in the email, and below is the code,
Note: I don't want to send it as an attachment, but want to show in the html.ejs page itself (i.e. in the email itself).
views/emailTemplates/forgotPassword/html.ejs
<p>Dear <%=recipientName%>,</p>
<br/>
<img src="/images/img1.png" width="300">
But it is not visible in the mail.
So how to include the images from assets/images folder to the above html.ejs file and make them visible in the mail that we send.
Please help me.
If your app is available on the internet, you can do that just by giving the making the src attribute absolute instead of relative. Something like this:
<img src="http://mywebsite.com/images/img1.png" width="300">
If your app is just on localhost or not online, then this won't work. The only solution then is to "embed" them image, which some email clients will display as attachments.
Note that some clients may show a "blocked remote content / click to allow remote content" message before they show your image properly.

Creating image data URI with proper format

I am sending html emails in php.I want to embed images so that images can be viewed directly
i used base64 encoding but it is not working as gmail is not supporting it.
But i received one email and it has image url in this format:
?ui=2&ik=f9790f3715&view=att&th=146e7afa75b55a47&attid=0.2&disp=emb&realattid=10bf591ea0437383_0.1&zw&atsh=1
and it was displayed directly. how is this working? any help please
These are embedded images. You send an image as an attachment and then use it in your img element like: <img src="cid:yourimage.png">. Gmail transforms the "cid" link to its internal file storage link and that's why it gives <img src="?ui=2&ik=..."> element.
This is one of two common ways to have images within email.
The other way is to keep images in your hosting and send img elements with external links: <img src="http://yourdomain.com/yourimage.png">
I strongly recommend to use the second approach especially if you expect to have a lot of images in your email. I had problems with attached images display on Gmail which I couldn't solve.

Get Content-ID of attached image when composing a new email in iOS

I'm using the MFMailComposeViewController in iOS to create a new dynamic email but have run into an issue when trying to use inline images.
I first tried adding the image as a base64 encoded string, i.e.
<img src="data:image/png;base64, blahblahblah" />
But I can only view that on the iPad while Outlook/Entourage ignore it even though I can see it in the source!
So now I'm trying to add the image as an attachment and link to it via it's content ID, i.e.
<img src="cid:BF6E8B41-4D74-419E-B55E-8F18A07381AE" id="BF6E8B41-4D74-419E-B55E-8F18A07381AE" width="509" height="220">
But have no clue how to get the cid through code!
When I attach an image using AddAttachmentData, the image goes to the bottom and actually generates an <img /> tag with the cid!
Additionally, this ID seems to change with every new email. The one above was my first try, then I sent another one and the Content-ID changed to
<img src="cid:59EBFDED-2A31-4787-BF67-9D9ED0FF2B39" id="59EBFDED-2A31-4787-BF67-9D9ED0FF2B39" width="509" height="220">
The reason I have to do this is because this is a dynamically generated image and it needs to sit inside an email template.
EDIT
I'm beginning to think that this isn't possible. I've been researching for hours now and it looks like iOS won't let you attach an image and link to it via its CID. Thanks Apple -_-
I've hit the same limitation of MFMailComposeViewController. It exposes no way to get content id (cid) of an email attachment, so there is no way to compose an html email message that references the attachment via img src='cid:...'. Since most email clients ignore data urls (inline base 64 encoded images), the best option for composing an html email message with images from an iOS app is to host the images on the web and reference them as img src='http://...'. Most email clients will ask the user for permission to download the images, so this is not ideal, but it's apparently the only option in iOS using public APIs.