Unable to get image in Email

Nishant Khandelwal asked on August 28, 2016 20:34

Hello,

I am trying to send Email with image attached. I created Email template for it. But when I receiving Email, Image is not appearing after getting Email.

What could be the problem?

Recent Answers


Laura Frese answered on August 28, 2016 21:30

What mail service are you using to review the email? Is it web based like gmail or is it outlook? Did you look at the code of the email HTML to see what the link to the image was? Did you use relative paths for the images or absolute (whole domain)?

0 votesVote for this answer Mark as a Correct answer

Nishant Khandelwal answered on August 29, 2016 08:50

Hi Laura,

Thanks for the feedback. Yes we are using the relative path but when I am trying to inspect it looks like it does not take domain name, I have tried to paste domain in inspect environment and image is visible.

Could you please give some suggestion how to get dynamic domain name in email template.

Thanks, Nishant

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on August 29, 2016 09:38

Nishant, you have use absolute path in this case. Reasons being relative paths are environment specific. So when you are using a relative path it will try to resolve it using current environment from where to resolve.

Since the email service on which you are using email doesn't have image that's why it is throwing 404 error.

You should absolute path when sending emails so that email service can resolve it correctly.

Faced this numerous times.

1 votesVote for this answer Mark as a Correct answer

Richard Sustek answered on August 29, 2016 10:46

As others suggest - every resource in an e-mail has to be publicly available and have absolute URL.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on August 29, 2016 16:05

In an email template you can get an absolute URL using the following macro:

<img src='{% RootDocument.AbsoluteURL %}images/image1.jpg' alt="image" />

Whatever domain you have in the Sites>Site 1 domain is what will be returned in the macro above.

0 votesVote for this answer Mark as a Correct answer

Nishant Khandelwal answered on August 29, 2016 20:01

Hi,

Thanks for your feedback.

Brenden, Now I can see domain name but as in the site>sitedomain has only domain name but in my URL sitedomain/default.aspx also coming.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on August 30, 2016 15:42

Then you need to ensure your settings are correct for the URL. Under Settings>Content>Web site content, set the default alias path. Under Settings>URLs & SEO>SEO - URLs set the default page to "Use domain root". This should eliminate the /default.aspx being added on the backside.

2 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.