7

I'm wondering how to send meeting request to allow GMail correctly recognize it?

If you try to send iCalendar meeting request definition given bellow as an alternative view using habitual code (also given bellow) via MailMessage object to GMail it will be resulted in not recognized meeting request:

enter image description here

But the mail with exactly the same meeting request sent via GMail UI results in recognized meeting request! Puzzling.

enter image description here

Does anybody know what "magic" I'm missing?

Good to notice that Outlook correctly recognizes exactly the same meeting request sent by given code. enter image description here

The code to send mail with meeting request:

class Program
{
    static string From = "sender@example.com";
    static string TimeFormat = "yyyyMMdd\\THHmmss\\Z";
    static string To = "target@example.dom";

    static void Main(string[] args)
    {
        string content = ReadFile("event-template.ics");

        content = content.Replace("#TO#", To);
        content = content.Replace("#FROM#", From);
        content = content.Replace("#UID#", Guid.NewGuid().ToString().Replace("-", ""));
        content = content.Replace("#CREATED-AT#", DateTime.UtcNow.AddDays(-1).ToString(TimeFormat));
        content = content.Replace("#DTSTART#", DateTime.UtcNow.AddDays(1).ToString(TimeFormat));
        content = content.Replace("#DTEND#", DateTime.UtcNow.AddDays(1).AddHours(1).ToString(TimeFormat));

        MailMessage message = new MailMessage();
        message.From = new MailAddress(From);
        message.To.Add(new MailAddress(To));
        message.Subject = "Meeting Request from Code!";

        var iCalendarContentType = new ContentType("text/calendar; method=REQUEST");

        var calendarView = AlternateView.CreateAlternateViewFromString(content, iCalendarContentType);
        calendarView.TransferEncoding = TransferEncoding.SevenBit;
        message.AlternateViews.Add(calendarView);

        using (var smtp = new SmtpClient())
        {
            smtp.Send(message);
        }
    }

    public static string ReadFile(string fileName)
    {
        using (StreamReader r = new StreamReader(fileName))
        {
            return r.ReadToEnd();
        }
    }
}

iCalendar template definition:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//A//B//EN
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER;CN="Organizer":mailto:#FROM#
ATTENDEE;CN="Attendee";CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=
 NEEDS-ACTION;RSVP=TRUE:mailto:#TO#
DTSTART:#DTSTART#
DTEND:#DTEND#
LOCATION:Location test
TRANSP:OPAQUE
SEQUENCE:0
UID:#UID#
DTSTAMP:#CREATED-AT#
CREATED:#CREATED-AT#
LAST-MODIFIED:#CREATED-AT#
DESCRIPTION:Test description\n
PRIORITY:5
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR

UPD. The source of email generated by code and received by GMail (not recognized by GMail as a meeting request): http://pastebin.com/MCU6P16Y.

The source of email composed by GMail during forwarding (recognized correclty): http://pastebin.com/zfbbj9Gg

IMPORTANT UPDATE. Just changing target from my email (<my>@gmail.com) to my colleague's one (<colleague>@gmail.com) and it starts to recognize properly! Now it definitely looks like GMail issue. (I'm sending email from the address that differs from target, sure)

UPDATE. Found exactly the same issue in GMail support forum: Bug: Gmail fails to recognize .ics calendar invitations attached to incoming messages. The issue dated by Jun, 2011 and reported as fixed to Jul, 2011. I've created new topic there: GMail fails to recognize *.ics attachment as a meeting request.

Eugene D. Gubenkov
  • 5,127
  • 6
  • 39
  • 71
  • Could you share the source of the actual email being sent? Including all headers and attachments. – Evert Dec 07 '14 at 01:31
  • @Evert, you can find the full source of email here: http://pastebin.com/MCU6P16Y – Eugene D. Gubenkov Dec 07 '14 at 14:51
  • @Evert, I've also added the source of forwarded email. – Eugene D. Gubenkov Dec 07 '14 at 14:59
  • this is an example in python of working code sending invites to google calendar and being recognised:http://stackoverflow.com/a/14648531/1167333 – Auberon Vacher Dec 07 '14 at 20:52
  • @oberron, the code you've provided also results in not recognized meeting request. Please, see the screenshot http://screencast.com/t/0dgasauEJ8 – Eugene D. Gubenkov Dec 08 '14 at 09:08
  • hi, i just ran it again and it worked for me, would you happen to have a domain name gmail? – Auberon Vacher Dec 09 '14 at 20:00
  • @oberron, please see the update, it says that exactly the same code sends an email to _another_ ..@gmail.com address correctly recognizes, so issue is GMail account dependent! I believe it's GMail issue. I'm sending email from ..@mail.ru to ..@gmail.com. Look at this: https://productforums.google.com/forum/#!topic/gmail/_Cu_5upaNC0%5B1-25-false%5D it's exactly the same issue appeared in 2011 and reported as fixed... – Eugene D. Gubenkov Dec 10 '14 at 08:05
  • @EugeneD.Gubenkov Could you please have a look at [this question](https://stackoverflow.com/questions/63733904/cannot-see-event-title-in-the-email-invitation-on-microsoft-outlook) as well? I do not know why Outlook is not recognizing the event name of my calendar invitation. – a_sid Sep 06 '20 at 01:03
  • @a_sid, i briefly took a look, found my old test snippets and found out that the invitations that they send are not being recognized by the gmail anymore... so it will require quite some time to investigate, not sure if i have time for that now, sorry – Eugene D. Gubenkov Sep 06 '20 at 06:00
  • @EugeneD.Gubenkov Thank you for the response. I am concerned about Outlook, not Gmail. – a_sid Sep 07 '20 at 02:17

2 Answers2

2

It seems that the problem is not with GMAIL recognizing the meeting request, but with problems displaying it. I was bugged by the same problem.

It was "fixed" after I changed GMAIL display language to "English (US)" from Settings menu.

So it is definitely a bug.

0

If you're using c# I managed to get this working outlook web, gmail, outlook 2016.

What it appears you need to do is add an alternate view, this doesn't appear to work when you have multiple views but does work for your example above.

The alternative view below:

                    var ct = new ContentType("text/calendar");

                    if (ct.Parameters != null)
                    {
                        ct.Parameters.Add("method", "REQUEST");
                        ct.Parameters.Add("charSet", "utf-8");

                        var avCal = AlternateView.CreateAlternateViewFromString(calendarAppt.ToString(), ct);
                        avCal.TransferEncoding = TransferEncoding.Base64;
                        mail.AlternateViews.Add(avCal);
                    }
TheNerdyNerd
  • 237
  • 2
  • 9