Answer the question
In order to leave comments, you need to log in
C# Is it possible to do without a library?
public static IRestResponse SendSimpleMessage() {
RestClient client = new RestClient();
client.BaseUrl = new Uri("https://api.mailgun.net/v3");
client.Authenticator =
new HttpBasicAuthenticator("api",
"key-11111111");
RestRequest request = new RestRequest();
request.AddParameter("domain",
"legends-game.ru", ParameterType.UrlSegment);
request.Resource = "{domain}/messages";
request.AddParameter("from", "Excited User <[email protected]>");
request.AddParameter("to", "[email protected]");
request.AddParameter("subject", "Hello");
request.AddParameter("text", "Testing some Mailgun awesomness!");
request.Method = Method.POST;
return client.Execute(request);
}
WebRequest request = WebRequest.Create("https://api.mailgun.net/v3");
request.Method = "GET";
request.AddParameter("from", "Excited User <[email protected]>");
request.AddParameter("to", "[email protected]");
WebResponse response = request.GetResponse();
response.Close();
Answer the question
In order to leave comments, you need to log in
.net 4.5+:
using(var client = new HttpClient()){
await client.GetAsync();
}
Can.
Light up the WebRequest class .
By the way, there was a similar question recently .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question