title: SendGrid V3 api with C# not able to send mail
body: <p>This is the code I am using. For some reason it gives an error: 'UnAuthorised'. Any ideas why this may be happening. The Api-key is correctly configured.</p>
  
  <pre><code>String apiKey = Environment.GetEnvironmentVariable("SG.7cSY-INMQnCwIzmonlgZvA.zNtNDycx......", EnvironmentVariableTarget.User);
              dynamic sg = new SendGrid.SendGridAPIClient(apiKey, "https://api.sendgrid.com");
  
              Email from = new Email("account@id.com");
              String subject = "Hello World from the SendGrid CSharp Library";
              Email to = new Email("someone@gmail.com");
              Content content = new Content("text/plain", "Textual content");
              Mail mail = new Mail(from, subject, to, content);
              //Email email = new Email("test2@example.com");
              //mail.Personalization[0].AddTo(email);
  
              String ret = mail.Get();
  
              string requestBody = ret;
              Console.WriteLine(ret);
  
              try
              {
                  dynamic response = sg.client.mail.send.beta.post(requestBody: requestBody);
                  Console.WriteLine(response.StatusCode);
                  Console.WriteLine(response.Body.ReadAsStringAsync().Result);
                  Console.WriteLine(response.Headers.ToString());
              }
              catch (Exception ex) {
                  Console.WriteLine("SendGrid Error: {0}",ex.Message);
              }
  </code></pre>