Hi, I cannot reproduce your problem, however, when I use mailgun I use the following code and it works fine for me. if you want to try.
public static IRestResponse SendSimpleMessage(string email)
{
var order = new CustomerOrder();
RestClient client = new RestClient();
client.BaseUrl = new Uri("https://api.mailgun.net/v3");
client.Authenticator =
new HttpBasicAuthenticator("api",
"key-MINE");
RestRequest request = new RestRequest();
request.AddParameter("domain",
"DOMAINHERE.mailgun.org", ParameterType.UrlSegment);
request.Resource = "{domain}/messages";
request.AddParameter("from", "Shop Staff <postmaster@EMAILTHING>");
request.AddParameter("to", email);
request.AddParameter("cc", "Shop Staff <insert email here>");
request.AddParameter("subject", "Your Order has been placed");
request.AddParameter("text", "Thank you for placing an order with our shop, we have just begun processing your order. You will recieve a follow up email when your order is ready for collection");
request.Method = Method.POST;
return client.Execute(request);
}
and then just call him
ResponseModel.SendSimpleMessage(email);
EDIT: the only problem I see in your code is the lack
request.Method = Method.POST;
POST methods are defined as follows: "The POST method is used to send an entity to a specified resource, often causing a change in state or side effects on the server"
I hope this helps
source
share