1

Hey I am not sure if this is a stupid question or not. Is there a way to dynamically change the link/greeting that a customer receives depending on the time of day they open the email we sent them. For example we sent the email at 11 am but the customer opened the email at 5pm. So they would get a message saying good evening instead of good morning. Thanks! -Karan

Karan K
  • 21
  • 7
  • Well, that's just how mail (whether electronic or not) works. A different greeting is appropriate than when giving them a phone call. – Bergi May 21 '18 at 14:51
  • Notice that time of day also depends on the location of the customer. – Bergi May 21 '18 at 14:51
  • Set a link, e.g. www.domain.com/link.php and then in the PHP have some logic that determines where to redirect the user to based on the current time – Chris May 21 '18 at 14:53

3 Answers3

0

Unfortunately, or maybe fortunately, no. That is because the moment you send the email you cannot change its content since you don't have control the data travelling across the network anymore. I am not sure about this, but you could create a customised greeting by sending html/css/js content. That might make the email end up in spam folder however.

Edit: Turns out you can't include javascript in emails [link]

George K
  • 481
  • 2
  • 13
0

You'd have to have the email sent in HTML format with embedded JavaScript and all email clients are going to block any JavaScript embedded in an an HTML message (most clients don't even process HTML formatted messages without warning the user).

What you should do is simply provide a link in the email and the link will take the recipient to your site, which would have the JavaScript in it to show a custom message based on the time of day.

Scott Marcus
  • 64,069
  • 6
  • 49
  • 71
  • Thank you that makes sense, I think I will have add a link that will take the customer to our site. – Karan K May 21 '18 at 14:57
0

Kinda.

As previous answers said, you can't embed javascript in your emails as pretty much all clients will block/strip the javascript. There also isn't any way to apply css rules based on time.

But what you could do, is have your greeting as image, and have the server decide which image to serve to the client. Now this still has issues, with biggest one being that you have to be able to guess clients time zone. This is probably impossible to do 100% reliably, but it's probably good enough to assume that the client is in the timezone where he registered or gave as his/her timezone when asked. This technique obviously will require that you host the images on your own server.

Keep in mind that some clients block images, so don't include anything important in them. I personally don't think this would be worth it, but it's definitely possible.

FINDarkside
  • 2,102
  • 1
  • 18
  • 26