Jump to content

Weird question, but still... Is there any method, api, anything to detect gmail client timezone setting?


Recommended Posts

Look at the data in the mail headers.

For example, an email from a friend of mine in Kentucky (timezone EST) had this in the header

Date: Sun, 28 Feb 2021 16:13:50 -0500
                                ^^^^^
                                |||||
                               GMT - 5 hrs

 

The answer is maybe. If you parse all the 'received from' headers you can usually (but not always) figure it out. There is a time stamp at the end of each that looks similar to this:

Sat, 20 Mar 2021 06:45:11 -0700

Most of the headers will have +0000 which are useless but if you find one like above, you have the UTC offset (-0700). In this case it is either MST or PDT. How you handle day light saving time is problematic.

Edited by gw1500se

Guys, thank you for your answers. I forgot to include that i should send email as php and the problem is that gmail should correctly display when it was received to include that time for hour calculation and display into email content. I have a user selected timezone in the backend, but people are amazing and wonder why the thing will start after email receival :D

The problem is basically: Your session will start at 6:00 AM, but email is displayed as received at 7:00 AM.

 

When it comes to the body content of your email, you just need to make it clear what timezone your referring too.  There's no way to automatically change it to whatever the receivers timezone is.

So instead of saying 'Your session starts at 6:00 AM'

You should say: 'Your session starts at 6:00 AM Eastern Standard Time'

Then the end-user can convert the time if necessary on their own.  If you can get them to tell you their timezone on your site before sending the email then you can send the message using that timezone, but still include the timezone indicator in case they selected the wrong timezone or have changed time zones since the message was sent.

Or you could simply say:

Your session will expire in X hours from the time of this email.

 

Then it's on them.  LOL

(a little sneaky, but Hey, it'll work and also remove complications on your end)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.