Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using RestSharp;
- using RestSharp.Authenticators;
- namespace ConsoleApp2
- {
- class Program
- {
- public static void Main(string[] args)
- {
- Console.WriteLine(SendSimpleMessage().Content.ToString());
- }
- public static IRestResponse SendSimpleMessage()
- {
- RestClient client = new RestClient();
- client.BaseUrl = new Uri("https://api.mailgun.net/v3/mail.offertracker.ru");
- client.Authenticator =
- new HttpBasicAuthenticator("api",
- "key-2c562d43500d272d79b471071713130e");
- RestRequest request = new RestRequest();
- request.AddParameter("domain", "https://mail.offertracker.ru", ParameterType.UrlSegment);
- request.Resource = "{domain}/messages";
- request.AddParameter("from", "info@offertracker.ru");
- request.AddParameter("to", "nanivskaya_ek@mail.ru");
- request.AddParameter("subject", "Hello");
- request.AddParameter("text", "Testing some Mailgun awesomness!");
- request.Method = Method.POST;
- return client.Execute(request);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement