title: Failed to send email using outlook office365 c# code
body: <p>I have written below code to send email using Outlook Office365.</p>
  
  <pre class="lang-cs prettyprint-override"><code>ExchangeService myService = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
  myService.Credentials = new WebCredentials(sender_mailId,sender_password);
  
  try
  {
    string serviceUrl = &lt;&lt;service url&gt;&gt; // This URL 
    myService.Url = new Uri(serviceUrl);
    EmailMessage emailMessage = new EmailMessage(myservice);
    emailMessage.Subject = "Subject test ";
    emailMessage.Body = new MessageBody("Testing Exchange Web Service API");
    emailMessage.ToRecipients.Add(to_email_id);
    emailMessage.Send();
  }
  catch (SmtpException exception)
  {
    string msg = "Mail cannot be sent (SmtpException):";
    msg += exception.Message;
    throw new Exception(msg);
  }
  </code></pre>
  
  <p>What web service URL should be used?</p>