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 <test@domain.ru>");
request.AddParameter("to", "my@gmail.com");
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 <test@domain.ru>");
request.AddParameter("to", "my@gmail.com");
WebResponse response = request.GetResponse();
response.Close();