简体   繁体   中英

How to use dynamic clickable images in emails

I am trying to add a dynamic image in my email with a link attached to the image.

In html this would be

<a href='www.myserver.com/getRedirectURL'>
  <img src='www.myserver.com/getImg' />
</a>

The problem is the image is dynamic, so multiple calls will yield different results. So if multiple people open the email at the same time, the same link could generate different images for different people. When they click the image, it should redirect them to my server which should then redirect them to the correct corresponding image site.

However, when they click the image, I have no way of knowing what the image that was rendered on the client was, so I am unable to redirect them to the correct site.

We can't use iframes or javascript in emails. So I can't select the image and feed it back to the redirect.

Is there any way I can ensure that the href + img source are always the correct pair without using javascript or iframe in an email?

If I'm understanding correctly, you want the image name passed through on the link? You'll need to use URL parameters to pass the information across.

For example ?image=getImg ,

<a href='www.myserver.com/getRedirectURL?image=getImg'>
  <img src='www.myserver.com/getImg' />
</a>

Then on the webpage, you can use any language you want (typically PHP or JavaScript) to extract the parameter details and supply the correct view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM