Reputation: 11
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"
//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\":\"[email protected]\"}]}],\"from\":{\"email\":\"[email protected]\"},\"subject\":\"testing login\",\"content\":[{\"type\":\"text/plain\",\"value\":\"tesing login login\"}]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
using "SendEmailAsync" Response: Id = 8, Status = WaitingForActivation, Method = "{null}", Result = "{Not yet computed}" using "RestClient" Response: Bad request ``
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.
Upvotes: 1
Views: 555