Send email with a Date and Time token shown in the recipients Timezone

Hi, I am sending an email to the user, via a button, to let him know how he can access my app and I also have a ValidUntil token where I tell him the link is valid until a certain time. However, my users can be in different time zones so I am trying to show them this date and time, in their own timezone. How can I configure the token in order to send him the date and time in his own timezone: Example: For me: My own currentDateTime + 2 hours (the time the link should be valid) For him: the equivalent in his own timezone of my currentDateTime + 2 hours. Any help would be greatly appreciated.  
1 answers

Although I dont have implementation level details I will try to provide some thought process:

  • One idea could be to use the TimeZone association for the User entity and localize the time to the users timezone using Java class. Then append the date to the email. 
    • But if you are sending the same email to, lets say, 1000 users then you must do this calculation for all the users in the runtime, which then might not be great idea.
  • Another idea is: you can also have deep link generated (which you might be doing already for sending links in email), append some expiry date time stamp. When the link is accessed, you can mention the link is expired. NOTE: this idea is only to avoid processing of expiry date time when sending emails


For tokens and email templates you can refer to