title: Emails not getting through Microsoft Graph
body: <p>I am building a process to send emails from my application. I signed up for a Office 365 org in Azure to test this. In my App registration, I granted the following permissions. The admin consent has been granted for these permissions.</p>
  <p><a href="https://i.stack.imgur.com/cVDRH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cVDRH.png" alt="Configured permissions" /></a></p>
  <p>Next I wrote this code, which is based off a github project.</p>
  <pre><code>        using Microsoft.Graph;
      using Microsoft.Graph.Auth;
      using Microsoft.Identity.Client;
      using System;
      using System.Collections.Generic;
      using System.Web.UI;
  
  namespace DemoOutlookMail
  {
      public partial class _Default : Page
      {
          protected void send_Click(object sender, System.EventArgs e)
          {
  
              const string tenantId = &quot;APP REGISTRATION TENANT ID&quot;;
              const string redirectUri = &quot;https://localhost:44316/&quot;;
              const string clientSecret = &quot;APP REGISTRATION SECRET&quot;;
              const string clientId = &quot;APP REGISTRATION CLIENT ID&quot;;
  
              const string AuthorityFormat = &quot;https://login.microsoftonline.com/{0}/v2.0&quot;;
              IConfidentialClientApplication daemonClient;
              daemonClient = ConfidentialClientApplicationBuilder.Create(clientId)
                  .WithAuthority(string.Format(AuthorityFormat, tenantId))
                  .WithRedirectUri(redirectUri)
                  .WithClientSecret(clientSecret)
                  .Build();
  
              ClientCredentialProvider authProvider = new ClientCredentialProvider(daemonClient,&quot;Mail.Send&quot;);
  
              GraphServiceClient graphClient = new GraphServiceClient(authProvider);
              SendEmail(graphClient);
          }
  
          private void SendEmail(GraphServiceClient graphClient)
          {
              var message = new Message
              {
                  Subject = &quot;Meet for lunch?&quot;,
                  Body = new ItemBody
                  {
                      ContentType = BodyType.Text,
                      Content = &quot;The new cafeteria is open.&quot;
                  },
                  ToRecipients = new List&lt;Recipient&gt;()
                          {
                          new Recipient
                          {
                              EmailAddress = new EmailAddress
                              {
                                  Address = &quot;AdeleV@testariesllc.onmicrosoft.com&quot;
                              }
                          }
              },
                  CcRecipients = new List&lt;Recipient&gt;()
                  {
                      new Recipient
                      {
                          EmailAddress = new EmailAddress
                          {
                              Address = &quot;AlexW@testariesllc.onmicrosoft.com&quot;
                          }
                      }
                  }
              };
  
              var saveToSentItems = false;
              try
              {
                  graphClient.Me.SendMail(message, saveToSentItems).Request().PostAsync();
              }
              catch(Exception e)
              {
                  Label1.Text = e.Message;
              }
          }
  
      }
  }
  </code></pre>
  <p>This code runs but doesn't send any emails, doesn't throw any exceptions. <strong>What am I missing?</strong>
  The original github project is <a href="https://github.com/Azure-Samples/ms-identity-aspnet-daemon-webapp" rel="nofollow noreferrer">https://github.com/Azure-Samples/ms-identity-aspnet-daemon-webapp</a></p>