1

Issue Summary

Response: Bad request

Not able to send mail from MVC c# web application : getting following error Response: Bad request : using "SendEmailAsync" Response: Id = 8, Status = WaitingForActivation, Method = "{null}", Result = "{Not yet computed}" using "RestClient"

Steps to Reproduce

  1. Use the above code in any MVC application with out static class
  2. Run the code
  3. same error will be thrown.

Code Snippet

//RestClient -- var client = new RestClient("https://api.sendgrid.com/v3/mail/send");
                client.Timeout = -1;
                var request = new RestRequest(Method.POST);
                request.AddHeader("Authorization", "Bearer Sendgridtoken");
                request.AddHeader("Content-Type", "application/json");
                request.AddParameter("application/json", "{\"personalizations\":[{\"to\":[{\"email\":\"jhon@abc.com\"}]}],\"from\":{\"email\":\"asd@xyz.com\"},\"subject\":\"testing login\",\"content\":[{\"type\":\"text/plain\",\"value\":\"tesing login login\"}]}", ParameterType.RequestBody);
                IRestResponse response = client.Execute(request);
                Console.WriteLine(response.Content);

Exception/Log

using "SendEmailAsync" Response: Id = 8, Status = WaitingForActivation, Method = "{null}", Result = "{Not yet computed}" using "RestClient" Response: Bad request ``

Technical details:

  • sendgrid-csharp version: SendGrid 9.22.0
  • csharp version: 4.5

Note :

We are not using any static method for this implementation We are not using this as a back job, we are implementing this as a method.

4

0 回答 0