dags att checka in
This commit is contained in:
16
MailGunTest/MailGunTest.csproj
Normal file
16
MailGunTest/MailGunTest.csproj
Normal file
@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Program.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RestSharp" Version="106.12.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
12
MailGunTest/Program.cs
Normal file
12
MailGunTest/Program.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace MailGunTest
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
}
|
||||
}
|
||||
}
|
||||
39
MailGunTest/SendSimpleMailChunk.cs
Normal file
39
MailGunTest/SendSimpleMailChunk.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using RestSharp;
|
||||
using RestSharp.Authenticators;
|
||||
|
||||
namespace MailGunTest
|
||||
{
|
||||
public class SendSimpleMailChunk
|
||||
{
|
||||
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.eu.mailgun.net/v3");
|
||||
client.Authenticator = new HttpBasicAuthenticator("api", "c416cb13b5937e7c2274f9f3038101cd-c485922e-70545ed4");
|
||||
|
||||
RestRequest request = new RestRequest();
|
||||
request.AddParameter("domain", "mg.tfoman.me", ParameterType.UrlSegment);
|
||||
request.Resource = "{domain}/messages";
|
||||
request.AddParameter("from", "Excited User <mailgun@mg.tfoman.me>");
|
||||
request.AddParameter("to", "tommy@oeman.se");
|
||||
request.AddParameter("to", "tommy.oman@mg.tfoman.me");
|
||||
request.AddParameter("to", "tommy.oman@gmail.com");
|
||||
request.AddParameter("subject", "Api-sent message TEST");
|
||||
request.AddParameter("text", "Let's see how it works!");
|
||||
request.Method = Method.POST;
|
||||
return client.Execute(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user