在Organizer的电子邮件中有一段时间后,SmtpClient无法发送会议邀请

时间:2017-10-29 18:13:33

标签: c# icalendar smtpclient outlook-calendar

我正在尝试使用C#发送会议邀请,并且由于某种原因,如果主办方的电子邮件地址有句号,则不会发送。

  

ORGANIZER; CN =“John,Song”:mailto:song.john@company.com

如果我删除电子邮件地址中的句号

,它将有效
  

ORGANIZER; CN =“John,Song”:mailto:songjohn@company.com

我的完整示例代码在这里。

public static void SendEmailString()
        {
            MailMessage msg = new MailMessage();
            msg.From = new MailAddress("song@company.com", "Song");
            msg.To.Add(new MailAddress("John@company.com", "John"));
            msg.Subject = "CS Inquiry";
            msg.Body = "TESTING";

            string test = @"BEGIN:VCALENDAR
            PRODID: -//Company & Com//Credit Inquiry//EN
            VERSION:2.0
            METHOD:REQUEST
            BEGIN:VEVENT
            ATTENDEE;CN=""John, Song"";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:song@company.com
            ATTENDEE;CN=""Lay, Sean"";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:lins@company.com
            ORGANIZER;CN="John, Song":mailto:song.john@company.com
            DTSTART:20171205T040000Z
            DTEND:20171206T040000Z
            LOCATION:New York
            TRANSP:TRANSPARENT
            SEQUENCE:0
            UID:a16fbc2b-72fd-487f-adee-370dc349a2273asfdasd
            DTSTAMP:20171027T215051Z
            DESCRIPTION:Request for information regarding Test
            SUMMARY:Summary 
            PRIORITY: 5
            CLASS: PUBLIC
            BEGIN:VALARM
            TRIGGER:-PT1440M
            ACTION: DISPLAY
            DESCRIPTION:REMINDER
            END:VALARM
            END:VEVENT
            END:VCALENDAR
            ";

            SmtpClient sc = new SmtpClient("smtp.company.com");

            System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar");
            ct.Parameters.Add("method", "REQUEST");
            AlternateView avCal = AlternateView.CreateAlternateViewFromString(test, ct);
            msg.AlternateViews.Add(avCal);

            sc.Send(msg);

        }

任何人都知道为什么会这样吗?我查看了iCalendar规范,但在Organizer的电子邮件地址中找不到关于句号是非法字符的任何内容。

谢谢!

0 个答案:

没有答案