Пытаюсь отправить письмо с помощью MailGun API
public IRestResponse SendMessage()
{
RestClient client = new RestClient();
client.BaseUrl = new Uri("https://api.mailgun.net/v3");
client.Authenticator =
new HttpBasicAuthenticator("api",
"my-api-key");
RestRequest request = new RestRequest();
request.AddParameter("domain", "abc.ru", ParameterType.UrlSegment);
request.Resource = "{domain}/messages";
request.AddParameter("from", "Excited User <mailgun@abc.ru>");
request.AddParameter("to", "hello@mail.ru");
request.AddParameter("subject", "Hello");
request.AddParameter("text", "Testing some Mailgun awesomness!");
request.Method = Method.POST;
return client.Execute(request);
}
Получаю в ответ следующий JSON
{
"request": null,
"contentType": null,
"contentLength": 0,
"contentEncoding": null,
"content": "",
"statusCode": 0,
"isSuccessful": false,
"statusDescription": null,
"rawBytes": null,
"responseUri": null,
"server": null,
"cookies": [
],
"headers": [
],
"responseStatus": 2,
"errorMessage": "Operation is not supported on this platform.",
"errorException": {
"ClassName": "System.PlatformNotSupportedException",
"Message": "Operation is not supported on this platform.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at System.Net.SystemWebProxy.GetProxy(Uri destination)\r\n at System.Net.ServicePointManager.ProxyAddressIfNecessary(Uri& address, IWebProxy proxy)\r\n at System.Net.ServicePointManager.FindServicePoint(Uri address, IWebProxy proxy)\r\n at System.Net.HttpWebRequest.get_ServicePoint()\r\n at RestSharp.Http.ConfigureWebRequest(String method, Uri url)\r\n at RestSharp.Http.PostPutInternal(String method)\r\n at RestSharp.Http.AsPost(String httpMethod)\r\n at RestSharp.RestClient.DoExecuteAsPost(IHttp http, String method)\r\n at RestSharp.RestClient.Execute(IRestRequest request, String httpMethod, Func`3 getResponse)",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146233031,
"Source": "System.Net.Requests",
"WatsonBuckets": null
},
"protocolVersion": null
}