title: 5.2.0 STOREDRV.Submission.Exception:InvalidRecipientsException
body: <p>I'm trying to send ics invitation mail to multiple recipients using outlook email id. but I'm getting this error...</p>
  
  <blockquote>
    <p>Transaction failed. The server response was: 5.2.0 STOREDRV.Submission.Exception:InvalidRecipientsException; Failed to process message due to a permanent exception with message A message can't be sent because it contains no recipients. InvalidRecipientsException: A message can't be sent because it contains no recipients.</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>public ResponseModel SendInvite(ZoomDTO data)
  {
      try
      {
          string startTime1 = TimeZoneInfo.ConvertTimeToUtc(Convert.ToDateTime(DateTime.Now.ToString())).ToString("yyyyMMddTHHmmssZ");
          string endTime1 = TimeZoneInfo.ConvertTimeToUtc(Convert.ToDateTime(DateTime.Now.AddDays(1).ToString())).ToString("yyyyMMddTHHmmssZ");
  
          SmtpClient sc = SmtpSettings();
          MailMessage msg = new MailMessage();
          msg.From = new MailAddress("donotreply@companyname.com", "Screen Detailing");
          if (data.TO_EMAIL.Contains(","))
          {
              string[] mailIds = data.TO_EMAIL.Split(',');
              foreach (var item in mailIds)
              {
                  msg.To.Add(new MailAddress(item));
              }
          }
          else
          {
              msg.To.Add(new MailAddress(data.TO_EMAIL));
          }
  
          msg.Subject = data.SUBJECT;
          msg.Body = "Zoom URL: " + data.ZOOM_URL + "  Meeting ID: " + data.MEETING_ID + "  Zoom Password: " + data.ZOOM_PWD; //emailbody
  
          StringBuilder str = new StringBuilder();
          str.AppendLine("BEGIN:VCALENDAR");
          //PRODID: identifier for the product that created the Calendar object
          str.AppendLine("PRODID:-//ABC Company//Outlook MIMEDIR//EN");
          str.AppendLine("VERSION:2.0");
          str.AppendLine("METHOD:REQUEST");
          str.AppendLine("BEGIN:VEVENT");
          str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", startTime1));//TimeZoneInfo.ConvertTimeToUtc("BeginTime").ToString("yyyyMMddTHHmmssZ")));
          str.AppendLine(string.Format("DTSTAMP:{0:yyyyMMddTHHmmssZ}", DateTime.Now));
          str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", endTime1));//TimeZoneInfo.ConvertTimeToUtc("EndTime").ToString("yyyyMMddTHHmmssZ")));
          str.AppendLine(string.Format("LOCATION: {0}", "Location"));
  
          // UID should be unique.
          str.AppendLine(string.Format("UID:{0}", Guid.NewGuid()));
          str.AppendLine(string.Format("DESCRIPTION:{0}", msg.Body));
          str.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}", msg.Body));
          str.AppendLine(string.Format("SUMMARY:{0}", msg.Subject));
          str.AppendLine("STATUS:CONFIRMED");
          str.AppendLine("BEGIN:VALARM");
          str.AppendLine("TRIGGER:-PT15M");
          str.AppendLine("ACTION:Accept");
          str.AppendLine("DESCRIPTION:Reminder");
          str.AppendLine("X-MICROSOFT-CDO-BUSYSTATUS:BUSY");
          str.AppendLine("END:VALARM");
          str.AppendLine("END:VEVENT");
          str.AppendLine(string.Format("ORGANIZER:MAILTO:{0}", msg.From.Address));
          str.AppendLine(string.Format("ATTENDEE;CN=\"{0}\";RSVP=TRUE:mailto:{1}", msg.To[0].DisplayName, msg.To[0].Address));
  
          str.AppendLine("END:VCALENDAR");
          System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar");
          ct.Parameters.Add("method", "REQUEST");
          ct.Parameters.Add("name", "meeting.ics");
          AlternateView avCal = AlternateView.CreateAlternateViewFromString(str.ToString(), ct);
          msg.AlternateViews.Add(avCal);
          //Response.Write(str);
          // sc.ServicePoint.MaxIdleTime = 2;
          sc.Send(msg);
  
          return new ResponseModel
          {
              ResultSet = "success",
              StatusCode = 1,
              StatusDescription = "Success",
              ReasonPhrase = string.Empty
          };
      }
      catch (Exception ex)
      {
          throw ex;
      }
  }
  
  private static SmtpClient SmtpSettings()
  {
      SmtpClient sc = new SmtpClient();
      sc.Host = "smtp.office365.com";
      sc.Port = 587;
      sc.UseDefaultCredentials = false;
      sc.Credentials = new System.Net.NetworkCredential("donotreply@companyname.com", "password");
      sc.EnableSsl = true;
      return sc;
  }
  </code></pre>
  
  <p>And the same code is working fine with gmail smtp settings and gmail id credentials.
  Plus the same code without ics meeting invitation is working fine with office365 smtp settings and my company's id credentials which are shown in above code.</p>