title: Email that is automatically parsed by Gmail and adds a Calendar event
body: <p>I hope this question is OK to ask here, given that it could replace my usage for Google Calendar API I think it should be OK.</p>
  <p><a href="https://stackoverflow.com/help/on-topic">https://stackoverflow.com/help/on-topic</a></p>
  <p><em>When you get an email about an event like a flight, concert, or restaurant reservation, it's added to your calendar automatically.</em></p>
  <p><a href="https://support.google.com/calendar/answer/6084018?co=GENIE.Platform%3DDesktop&amp;hl=en" rel="noreferrer">https://support.google.com/calendar/answer/6084018?co=GENIE.Platform%3DDesktop&amp;hl=en</a></p>
  <p>I think this is a really neat feature but I would like to know If I can create an email that will automatically show up in my calendar myself. I'm currently using the Calendar API, <a href="https://www.nuget.org/packages/Google.Apis.Calendar.v3/" rel="noreferrer">Google.Apis.Calendar.v3</a>, but if I could get this to work my application would not need to handle credentials anymore which would be really great.</p>
  <p>Cases where the email won't show up according to support page:</p>
  <p><strong>Events won't show up if the email was:</strong></p>
  <ul>
  <li>Sent to a mailing list</li>
  <li>Sent to you by cc</li>
  <li>Redirected from another email account</li>
  </ul>
  <p><strong>Events are only added if they are in confirmation emails from businesses about:</strong></p>
  <ul>
  <li>Flights</li>
  <li>Hotels</li>
  <li>Restaurants</li>
  <li>Ticketed events like movies and concerts</li>
  </ul>
  <p>I have been reading up on <code>Events from Gmail</code> and created the sample below.</p>
  <p><a href="https://developers.google.com/gmail/markup/google-calendar" rel="noreferrer">https://developers.google.com/gmail/markup/google-calendar</a></p>
  <p><a href="https://developers.google.com/gmail/markup/getting-started" rel="noreferrer">https://developers.google.com/gmail/markup/getting-started</a></p>
  <p><a href="https://developers.google.com/gmail/markup/reference/event-reservation" rel="noreferrer">https://developers.google.com/gmail/markup/reference/event-reservation</a></p>
  <pre><code>&lt;html&gt;
  &lt;body&gt;
      &lt;script type=&quot;application/ld+json&quot;&gt;
          {
          &quot;@context&quot;: &quot;http://schema.org&quot;,
          &quot;@type&quot;: &quot;EventReservation&quot;,
          &quot;reservationNumber&quot;: &quot;E123456789&quot;,
          &quot;reservationStatus&quot;: &quot;http://schema.org/Confirmed&quot;,
          &quot;underName&quot;: {
          &quot;@type&quot;: &quot;Person&quot;,
          &quot;name&quot;: &quot;Oscar Andersson&quot;
          },
          &quot;reservationFor&quot;: {
          &quot;@type&quot;: &quot;Event&quot;,
          &quot;name&quot;: &quot;Foo Fighters Concert&quot;,
          &quot;performer&quot;: {
          &quot;@type&quot;: &quot;Organization&quot;,
          &quot;name&quot;: &quot;The Foo Fighters&quot;,
          &quot;image&quot;: &quot;http://www.amprocktv.com/wp-content/uploads/2027/01/foo-fighters-1-680x383.jpg&quot;
          },
          &quot;startDate&quot;: &quot;2019-05-08T19:30:00-01:00&quot;,
          &quot;endDate&quot;: &quot;2019-05-08T23:00:00-01:00&quot;,
          &quot;location&quot;: {
          &quot;@type&quot;: &quot;Place&quot;,
          &quot;name&quot;: &quot;AT&amp;T Park&quot;,
          &quot;address&quot;: {
          &quot;@type&quot;: &quot;PostalAddress&quot;,
          &quot;streetAddress&quot;: &quot;AT&amp;T Park&quot;,
          &quot;addressLocality&quot;: &quot;San Francisco&quot;,
          &quot;addressRegion&quot;: &quot;CA&quot;,
          &quot;postalCode&quot;: &quot;94107&quot;,
          &quot;addressCountry&quot;: &quot;US&quot;
          }
          }
          },
          &quot;ticketToken&quot;: &quot;qrCode:AB34&quot;,
          &quot;ticketNumber&quot;: &quot;abc123&quot;,
          &quot;numSeats&quot;: &quot;1&quot;,
          &quot;modifiedTime&quot;: &quot;2019-05-07T15:15:00-01:00&quot;,
          &quot;modifyReservationUrl&quot;: &quot;http://united.com/modifyreservation.html&quot;
          }
      &lt;/script&gt;
  
      &lt;p&gt;
          Dear Oscar, thanks for booking your Google I/O ticket with us.
      &lt;/p&gt;
      &lt;p&gt;
          BOOKING DETAILS&lt;br /&gt;
          Reservation number: IO12345&lt;br /&gt;
          Order for: Oscar Andersson&lt;br /&gt;
          Event: Google I/O 2013&lt;br /&gt;
          Start time: May 15th 2013 8:00am PST&lt;br /&gt;
          Venue: Moscone Center, 800 Howard St., San Francisco, CA 94103&lt;br /&gt;
      &lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>I have validated the markup with <code>Email Markup Tester</code> from Google and it says <code>No errors detected</code>. Then I imported the HTML above from Notepad++ to Outlook via Run -&gt; Send via Outlook and sent it to my Gmail. I received the email but the Calendar event was not present.</p>
  <p><a href="https://www.google.com/webmasters/markup-tester/" rel="noreferrer">https://www.google.com/webmasters/markup-tester/</a></p>
  <p>According to their documentation <code>All schemas you send to yourself (from x@gmail.com to x@gmail.com) will be displayed in Google products.</code> but I can't see the event.</p>
  <p><a href="https://developers.google.com/gmail/markup/registering-with-google" rel="noreferrer">https://developers.google.com/gmail/markup/registering-with-google</a></p>
  <p>I have tried creating my own program to send the email via Gmail servers to myself but the events still don't show. Tried copying a lot of the events mentioned on their guides and reference page.</p>
  <pre><code>var emailAddress = new MailAddress(&quot;myGmail@gmail.com&quot;, &quot;Ogglas&quot;);
  
  SmtpClient smtpClient = new SmtpClient();
  smtpClient.Host = &quot;smtp.gmail.com&quot;;
  smtpClient.Port = 587;
  smtpClient.EnableSsl = true;
  smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
  smtpClient.UseDefaultCredentials = false;
  smtpClient.Credentials = new NetworkCredential(&quot;myGmail@gmail.com&quot;, &quot;mySuperSecurePassword789&amp;&quot;);
  
  MailMessage mailMessage = new MailMessage();
  mailMessage.From = emailAddress;
  mailMessage.To.Add(emailAddress);
  mailMessage.Subject = &quot;Concert test&quot;;
  mailMessage.IsBodyHtml = true;
  
  var currentPath = Directory.GetCurrentDirectory();
  var htmlEmail = File.ReadAllText(currentPath + &quot;\\Email.html&quot;);
  mailMessage.Body = htmlEmail;
  
  smtpClient.Send(mailMessage);
  </code></pre>
  <p>Example from a flight how I would like it to look:</p>
  <p>Gmail:</p>
  <p><a href="https://i.stack.imgur.com/RvCaY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RvCaY.png" alt="enter image description here" /></a></p>
  <p>Calendar:</p>
  <p><a href="https://i.stack.imgur.com/iOlHT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iOlHT.png" alt="enter image description here" /></a></p>
  <p>Example from booking.com</p>
  <p><a href="https://i.stack.imgur.com/hYRti.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hYRti.png" alt="enter image description here" /></a></p>
  <p>Has anyone here managed to get this working?</p>