documentation icon indicating copy to clipboard operation
documentation copied to clipboard

C# Documentation is outdated

Open danzel opened this issue 7 years ago • 1 comments

RestSharp is dead, should be using HttpClient instead.

danzel avatar Aug 15 '17 03:08 danzel

Something like this:

var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(string.Format("{0}:{1}", "api", MailGunApiKey))));
var content = new MultipartFormDataContent();

content.Add(new StringContent(from), "from");
content.Add(new StringContent(address), "to");
content.Add(new StringContent(subject), "subject");
content.Add(new StringContent(body), "text");

var result = await client.PostAsync("https://api.mailgun.net/v3/DOMAINGOESHERE/messages", content);

danzel avatar Aug 15 '17 04:08 danzel