0

Im creating this email markup on Sendgrid and the design includes a countdown time showing how many day, hours,minutes and seconds there is before the deadline, havent tried using Javascript on sendgrid yet but is it possible? Do I just put a in there?

4
  • 4
    If you mean "can I use Javascript in an email", then the answer is no. 99% of email clients will not allow Javascript to execute in a HTML email, for security reasons.
    – ADyson
    Commented Apr 28, 2020 at 8:34
  • 2
    Email is not Browser. Email clients has lots of restrictions
    – Justinas
    Commented Apr 28, 2020 at 8:35
  • Now I really dont know how to do the countdown timer for that email markup. Thanks for the help anyways much appriciated.
    – DexPapa
    Commented Apr 28, 2020 at 9:07
  • 1
    "Now I really dont know how to" You can't do any kind of dynamic content in an email (apart from a gif, maybe!). So you will have to forget about the whole idea. You could do it on a webpage which is linked from the email, that's about the best outcome you can get.
    – ADyson
    Commented Apr 28, 2020 at 9:36

1 Answer 1

1

It looks like your question is rather "how can I do a countdown timer in email", and I'll answer that.

In a nutshell, you use animated gifs in combination with a server-side trick to change what image loads when the gifs display. That trick is to use a GIF-encoder that tricks the email client into thinking the php link is actually a GIF:

<img src="http://mosaichosting.co.uk/countdown/2/gif.php?time=2014-12-25+00:00:01" alt="Countdown" border="0" style="display:block;">

To setup the PHP script, follow these instructions (it's quite long): https://litmus.com/community/learning/27-how-to-add-a-countdown-timer-to-your-email

Or to have a setup do it for you there are free and paid alternatives. See this free one: https://www.sendtric.com/

4
  • Does this fall under ethical workaround? I'm not accusing you of anything, I'm genuinely curious if this is completely acceptable.
    – Joel Hager
    Commented Apr 28, 2020 at 22:47
  • 1
    @JoelHager It's widely used, but, that doesn't mean anything about whether it is ethical, of course. I think perhaps I overused the word 'trick' here which triggered this thought. It appears to be secure, or otherwise email clients would have barred it by now. The only other ethical consideration would be adding a sense of urgency unnecessarily, just to make you buy it. That may be wrong in some cases, but that aspect doesn't have anything to do with the use of PHP in email as such.
    – Nathan
    Commented Apr 29, 2020 at 1:44
  • Very interesting. I'll definitely have to look into that. It's definitely an interesting topic for consideration!
    – Joel Hager
    Commented Apr 29, 2020 at 1:52
  • @Nathan Will try to work with this. Thanks sir for the help.
    – DexPapa
    Commented Apr 29, 2020 at 9:34

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.