Mailgun Send Email C

[Solved] Mailgun Send Email C | Php - Code Explorer | yomemimo.com
Question : Mailgun send email C#

Answered by : josereanto

using System;
using System.IO;
using RestSharp;
using RestSharp.Authenticators;
public class SendSimpleMessageChunk
{ 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"); client.Authenticator = new HttpBasicAuthenticator ("api", "YOUR_API_KEY"); RestRequest request = new RestRequest (); request.AddParameter ("domain", "YOUR_DOMAIN_NAME", ParameterType.UrlSegment); request.Resource = "{domain}/messages"; request.AddParameter ("from", "Excited User <mailgun@YOUR_DOMAIN_NAME>"); request.AddParameter ("to", "[email protected]"); request.AddParameter ("to", "YOU@YOUR_DOMAIN_NAME"); request.AddParameter ("subject", "Hello"); request.AddParameter ("text", "Testing some Mailgun awesomness!"); request.Method = Method.POST; return client.Execute (request); }
}

Source : https://documentation.mailgun.com/en/latest/quickstart-sending.html#send-via-api | Last Update : Thu, 25 Aug 22

Answers related to mailgun send email c

Code Explorer Popular Question For Php