t00r777 Posted March 20, 2021 Share Posted March 20, 2021 Nonsense question, but still... Is there any method to detect gmail client timezone setting? Like mobile app and web gmail client? Not browser or IP or similar, but gmail. Thank you for your answers. Quote Link to comment https://forums.phpfreaks.com/topic/312343-weird-question-but-still-is-there-any-method-api-anything-to-detect-gmail-client-timezone-setting/ Share on other sites More sharing options...
Barand Posted March 20, 2021 Share Posted March 20, 2021 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 Quote Link to comment https://forums.phpfreaks.com/topic/312343-weird-question-but-still-is-there-any-method-api-anything-to-detect-gmail-client-timezone-setting/#findComment-1585244 Share on other sites More sharing options...
gw1500se Posted March 20, 2021 Share Posted March 20, 2021 (edited) 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 March 20, 2021 by gw1500se Quote Link to comment https://forums.phpfreaks.com/topic/312343-weird-question-but-still-is-there-any-method-api-anything-to-detect-gmail-client-timezone-setting/#findComment-1585245 Share on other sites More sharing options...
t00r777 Posted March 20, 2021 Author Share Posted March 20, 2021 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 The problem is basically: Your session will start at 6:00 AM, but email is displayed as received at 7:00 AM. Quote Link to comment https://forums.phpfreaks.com/topic/312343-weird-question-but-still-is-there-any-method-api-anything-to-detect-gmail-client-timezone-setting/#findComment-1585246 Share on other sites More sharing options...
kicken Posted March 20, 2021 Share Posted March 20, 2021 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. Quote Link to comment https://forums.phpfreaks.com/topic/312343-weird-question-but-still-is-there-any-method-api-anything-to-detect-gmail-client-timezone-setting/#findComment-1585247 Share on other sites More sharing options...
phppup Posted March 20, 2021 Share Posted March 20, 2021 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) Quote Link to comment https://forums.phpfreaks.com/topic/312343-weird-question-but-still-is-there-any-method-api-anything-to-detect-gmail-client-timezone-setting/#findComment-1585258 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.