Hi,
I have below code using RestSharp but it's not working on my project due to compatibility issues.
I want to ask how can I change the same to work with HttpClient?
RestClient client = new RestClient();
client.BaseUrl = new Uri("https://api.mailgun.net/v3");
client.Authenticator = new HttpBasicAuthenticator("api", "key-fbd876ed51232f347042d0009d9xxxxxx");
RestRequest request = new RestRequest();
request.AddParameter("domain", "domain.softnames.com", ParameterType.UrlSegment);
request.Resource = "{domain}/messages";
request.AddParameter("from", "Excited User ");
request.AddParameter("to", "uk@softnames.com");
request.AddParameter("subject", "Hello");
request.AddParameter("text", "Testing some Mailgun awesomness! This is all about the text only. Just testing the text of this email.");
request.Method = Method.POST;
client.Execute(request);
Thanks,
解决方案
Hi Jassim RAahma,
Thank you for posting here.
If you want to make REST request using c# like HttpClient, you could refer to the following link.
Best Regards,
Wendy