title: SendGrid doesn't want to send emails ASP .NET CORE
body: <p>I am new to sending emails and I chose SendGrid for that. I ran through many tutorials, but it just doesn't want to send any email.
  This is the code for my <code>sendEmail</code> controller:</p>
  <pre class="lang-cs prettyprint-override"><code>using Microsoft.AspNetCore.Mvc;
  using SendGrid;
  using SendGrid.Helpers.Mail;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  
  namespace UnblockMe.Controllers
  {
      public class EmailController : Controller
      {
       
              public IActionResult SendEmail()
              {
                  var apikey = Environment.GetEnvironmentVariable(&quot;emailKey&quot;);
                  var client = new SendGridClient(apikey);
                  var from = new EmailAddress(&quot;test@gmail.com&quot;,&quot;Test&quot;);
                  var to = new EmailAddress(&quot;test999@gmail.com&quot;,&quot;Test&quot;);
                  var subject = &quot;Sending EMAIL&quot;;
                  var PlainTextContent = &quot;asdadsasdadsad&quot;;
                  var htmlcontent = &quot;&lt;strong&gt;asdadsasd&lt;/strong&gt;&quot;;
                  var msg = MailHelper.CreateSingleEmail
                      (
                          from,
                          to,
                          subject,
                          PlainTextContent,
                          htmlcontent
                      );
                  var response = client.SendEmailAsync(msg);
                  return Content(msg.ToString());
              }
          
      }
  }
  </code></pre>
  <p>And in <code>view</code> I have something like this:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;form&gt; 
     ....
     &lt;button type=&quot;submit&quot; asp-controller=&quot;Email&quot; asp-action=&quot;SendEmail&quot;&gt;Unblock Me!&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>I didn't make any change in Startup or something like that. Can anyone teach me how to make this thing work?</p>