1

Google calendar invite emails will update after they are sent if the original event has been changed... how does Google achieve this? Is there a general technique for anyone to do this? Or is this only possible because Google owns both gMail/gCalendar and the two systems are integrated behind the scenes outside of SMTP?

My first guess was that they used an iframe or an image that was loaded when the email was opened, but inspecting the source of the gMail page doesn't show any signs of that.

Here's a screenshot of the updated text: enter image description here

And here's the HTML for that section of the page when reading the email within gMail: enter image description here

d2vid
  • 2,014
  • 1
  • 22
  • 25

2 Answers2

3

Note :

Inspecting Source wil give you nothing other than the markup of the content you see in the page after all dynamic operations including ajax.

To check the actual source, you want to visit view-source:url.

Now the question

That information is updated automatically at Run time via a JavaScript code.

In the image, you checked on Inspect element, which show the code of live view and so, you saw the updated content.

It is done by JavaScript DOM and text manipulation.

To verify this,

  1. Click on the address bar.
  2. add view-source: before the url. So, it will look like view-source:https://url
  3. Then press ctrl+f or the corresponding key to find.
  4. Search for the <div id=":8hg" which will show 0 results.

The view-source is load the source of the file without any ajax or JavaScript manipulation.

The div is not present in the source. So, we can understand that it is done dynamically.

When checking in detail,

in the source, we can see a link https://www.google.com/calendar/event?action\u003dVIEW\u0026eid\u003db..... which is stored in an array.

From this link, the content is taken.

enter image description here

(I blacked out some text for privacy).

Based on the return of the url, the content on mail is upated.

To verify this,

In the mail, you can see This invitation is out of date

But in the view-source: page, search for This invitation is out of date and it will return 0 results.

So, it is sure that the Calendar details are taken via an API call by Gmail to the G Calendar API.

Community
  • 1
  • 1
Sagar V
  • 12,158
  • 7
  • 41
  • 68
  • 1
    This implies that Google has made an exception allowing emails from gCalendar to run inline javascript within gMail. Apparently this is generally not allowed: http://stackoverflow.com/questions/3054315/is-javascript-supported-in-an-email-message – d2vid Apr 04 '17 at 15:30
0

I wonder if on sending the email they create an image at some url and then if it changes they just remove it, then in the email they have something like

<div id="updated"></div>
<img src="asdfawe" onerror="document.getElementById('updated').innerhtml="some text""/>

Although im not sure if they can't use the onerror attribute (b/c email + js = bad idea). the only other way is just to use alt attribute and use some css trickery but I don't see how that could result in the inspected code.