dags att checka in

This commit is contained in:
2021-08-02 12:41:02 +02:00
parent 5648effc9a
commit 668659bf20
34 changed files with 1092 additions and 5 deletions

View 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
View File

@ -0,0 +1,12 @@
using System;
namespace MailGunTest
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View 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);
}
}
}