MailinatorApiClient 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package MailinatorApiClient --version 1.0.3
NuGet\Install-Package MailinatorApiClient -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MailinatorApiClient" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MailinatorApiClient --version 1.0.3
#r "nuget: MailinatorApiClient, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MailinatorApiClient as a Cake Addin
#addin nuget:?package=MailinatorApiClient&version=1.0.3

// Install MailinatorApiClient as a Cake Tool
#tool nuget:?package=MailinatorApiClient&version=1.0.3

Mailinator API Client Library

C# Client Library used to interact with the Mailinator API Please read our documentation for instructions on how to start using the API.

How to Install

PM> Install-Package MailinatorApiClient

Usage

To start using the API you need to first create an account at mailinator.com.

Once you have an account you will need an API Token which you can generate in mailinator.com/v3/#/#team_settings_pane.

Then you can configure the library with:

  using mailinator_csharp_client;

  MailinatorClient mailinatorClient = new MailinatorClient("yourApiTokenHere");

Examples

Domains methods:
  • Get AllDomains / Domain:

      using mailinator_csharp_client;
      using mailinator_csharp_client.Models.Domains.Requests;
      using mailinator_csharp_client.Models.Domains.Responses;
    
      MailinatorClient mailinatorClient = new MailinatorClient("yourApiTokenHere");
    
      //Get All Domains
      GetAllDomainsResponse getAllDomainsResponse = await mailinatorClient.DomainsClient.GetAllDomainsAsync();
    
      //Get Domain
      GetDomainRequest getDomainRequest = new GetDomainRequest() { DomainId = "yourDomainIdHere" };
      GetDomainResponse getDomainResponse = await mailinatorClient.DomainsClient.GetDomainAsync(getDomainRequest);
      // ...
    
Rules methods:
  • Create / Delete Rule:

      using mailinator_csharp_client;
      using mailinator_csharp_client.Models.Rules.Entities;
      using mailinator_csharp_client.Models.Rules.Requests;
      using mailinator_csharp_client.Models.Rules.Responses;
      using System.Collections.Generic;
    
      MailinatorClient mailinatorClient = new MailinatorClient("yourApiTokenHere");
    
      //Create Rule
      RuleToCreate ruleToCreate = new RuleToCreate()
              {
                  Name = "RuleName",
                  Priority = 15,
                  Description = "Description",
                  Conditions = new List<Condition>()
                  {
                      new Condition()
                      {
                          Operation = OperationType.PREFIX,
                          ConditionData = new ConditionData()
                          {
                              Field = "to",
                              Value = "raul"
                          }
                      }
                  },
                  Enabled = true,
                  Match = MatchType.ANY,
                  Actions = new List<ActionRule>() { new ActionRule() { Action = ActionType.WEBHOOK, ActionData = new ActionData() { Url = "https://www.google.com" } } }
              };
              CreateRuleRequest createRuleRequest = new CreateRuleRequest() { DomainId = "yourDomainIdHere", Rule = ruleToCreate };
              CreateRuleResponse createRuleResponse = await mailinatorClient.RulesClient.CreateRuleAsync(createRuleRequest);
    
          //Delete Rule
          DeleteRuleRequest deleteRuleRequest = new DeleteRuleRequest() { DomainId = "yourDomainIdHere", RuleId = "yourRuleIdHere" };
          DeleteRuleResponse deleteRuleResponse = await mailinatorClient.RulesClient.DeleteRuleAsync(deleteRuleRequest);
          // ...
    
  • Enable/Disable Rule:

      using mailinator_csharp_client;
      using mailinator_csharp_client.Models.Rules.Requests;
      using mailinator_csharp_client.Models.Rules.Responses;
    
      MailinatorClient mailinatorClient = new MailinatorClient("yourApiTokenHere");
    
      //Enable Rule
      EnableRuleRequest enableRuleRequest = new EnableRuleRequest() { DomainId = "yourDomainIdHere", RuleId = "yourRuleIdHere" };
      EnableRuleResponse enableRuleResponse = await mailinatorClient.RulesClient.EnableRuleAsync(enableRuleRequest);
    
      //Disable Rule
      DisableRuleRequest disableRuleRequest = new DisableRuleRequest() { DomainId = "yourDomainIdHere", RuleId = "yourRuleIdHere" };
      DisableRuleResponse disableRuleResponse = await mailinatorClient.RulesClient.DisableRuleAsync(disableRuleRequest);
    
  • Get All Rules / Rule:

    using mailinator_csharp_client;
    using mailinator_csharp_client.Models.Rules.Requests;
    using mailinator_csharp_client.Models.Rules.Responses;

    MailinatorClient mailinatorClient = new MailinatorClient("yourApiTokenHere");

    //Get All Rules
    var getAllRulesRequest = new GetAllRulesRequest() { DomainId = "yourDomainIdHere" };
    var getAllRulesResponse = await mailinatorClient.RulesClient.GetAllRulesAsync(getAllRulesRequest);
    
    //Get Rule
    var getRuleRequest = new GetRuleRequest() { DomainId = "yourDomainIdHere", RuleId = "yourRuleIdHere" };
    var getRuleResponse = await mailinatorClient.RulesClient.GetRuleAsync(getRuleRequest);
Messages methods:
  • Inject Message:

      using mailinator_csharp_client;
      using mailinator_csharp_client.Models.Messages.Entities;
      using mailinator_csharp_client.Models.Messages.Requests;
      using mailinator_csharp_client.Models.Messages.Responses;
    
      MailinatorClient mailinatorClient = new MailinatorClient("yourApiTokenHere");
    
      MessageToPost messageToPost = new MessageToPost()
              {
                  Subject = "Testing message",
                  From = "test_email@test.com",
                  Text = "Hello World!"
              };
      InjectMessageRequest injectMessageRequest = new InjectMessageRequest() { Domain = "yourDomainNameHere", Inbox = "yourInboxHere", Message = messageToPost };
      InjectMessageResponse injectMessageResponse = await mailinatorClient.MessagesClient.InjectMessageAsync(injectMessageRequest);
      // ...
    
  • Fetch Inbox / Message / SMS Messages / Attachments / Attachment:

      using mailinator_csharp_client;
      using mailinator_csharp_client.Models.Messages.Entities;
      using mailinator_csharp_client.Models.Messages.Requests;
      using mailinator_csharp_client.Models.Messages.Responses;
    
      MailinatorClient mailinatorClient = new MailinatorClient("yourApiTokenHere");
    
      //Fetch Inbox
      FetchInboxRequest fetchInboxRequest = new FetchInboxRequest() { Domain = "yourDomainNameHere", Inbox = "yourInboxHere", Skip = 0, Limit = 20, Sort = Sort.asc };
      FetchInboxResponse fetchInboxResponse = await mailinatorClient.MessagesClient.FetchInboxAsync(fetchInboxRequest);
    
      //Fetch Message
      FetchMessageRequest fetchMessageRequest = new FetchMessageRequest() { Domain = "yourDomainNameHere", Inbox = "yourInboxHere", MessageId = "yourMessageIdHere" };
      FetchMessageResponse fetchMessageResponse = await mailinatorClient.MessagesClient.FetchMessageAsync(fetchMessageRequest);
    
      //Fetch SMS Messages
      FetchSMSMessagesRequest fetchSMSMessagesRequest = new FetchSMSMessagesRequest() { Domain = "yourDomainNameHere", TeamSMSNumber = "yourTeamSMSNumberHere" };
      FetchSMSMessagesResponse fetchSMSMessagesResponse = await mailinatorClient.MessagesClient.FetchSMSMessagesAsync(fetchSMSMessagesRequest);
    
      //Fetch Attachments
      FetchAttachmentsRequest fetchAttachmentsRequest = new FetchAttachmentsRequest() { Domain = "yourDomainNameHere", Inbox = "yourInboxHere", MessageId = "yourMessageIdWithAttachmentHere" };
      FetchAttachmentsResponse fetchAttachmentsResponse = await mailinatorClient.MessagesClient.FetchAttachmentsAsync(fetchAttachmentsRequest);
    
      //Fetch Attachment
      FetchAttachmentRequest fetchAttachmentRequest = new FetchAttachmentRequest() { Domain = "yourDomainNameHere", Inbox = "yourInboxHere", MessageId = "yourMessageIdWithAttachmentHere", AttachmentId = "yourAttachmentIdHere" };
              FetchAttachmentResponse fetchAttachmentResponse = await mailinatorClient.MessagesClient.FetchAttachmentAsync(fetchAttachmentRequest);
    
      //Fetch Message Links
      FetchMessageLinksRequest fetchMessageLinksRequest = new FetchMessageLinksRequest() { Domain = "yourDomainNameHere", Inbox = "yourInboxHere", MessageId = "yourMessageIdWithAttachmentHere" };
              FetchMessageLinksResponse fetchMessageLinksResponse = await mailinatorClient.MessagesClient.FetchMessageLinksAsync(fetchMessageLinksRequest);
    
  • Delete Message / AllInboxMessages / AllDomainMessages

      using mailinator_csharp_client;
      using mailinator_csharp_client.Models.Messages.Requests;
      using mailinator_csharp_client.Models.Messages.Responses;
    
      MailinatorClient mailinatorClient = new MailinatorClient("yourApiTokenHere");
    
      //Delete Message
      DeleteMessageRequest deleteMessageRequest = new DeleteMessageRequest() { Domain = "yourDomainNameHere", Inbox = "yourInboxHere", MessageId = "yourMessageIdHere" };
      DeleteMessageResponse deleteMessageResponse = await mailinatorClient.MessagesClient.DeleteMessageAsync(deleteMessageRequest);
    
      //Delete All Inbox Messages
      DeleteAllInboxMessagesRequest deleteAllInboxMessagesRequest = new DeleteAllInboxMessagesRequest() { Domain = "yourDomainNameHere", Inbox = "yourInboxHere" };
      DeleteAllInboxMessagesResponse deleteAllInboxMessagesResponse = await mailinatorClient.MessagesClient.DeleteAllInboxMessagesAsync(deleteAllInboxMessagesRequest);
    
      //Delete All Domain Messages
      DeleteAllDomainMessagesRequest deleteAllDomainMessagesRequest = new DeleteAllDomainMessagesRequest() { Domain = "yourDomainNameHere" };
      DeleteAllDomainMessagesResponse deleteAllDomainMessagesResponse = await mailinatorClient.MessagesClient.DeleteAllDomainMessagesAsync(deleteAllDomainMessagesRequest);
    
Stats methods:
  • Get Team / Team Stats:

      using mailinator_csharp_client;
      using mailinator_csharp_client.Models.Domains.Requests;
      using mailinator_csharp_client.Models.Domains.Responses;
    
      MailinatorClient mailinatorClient = new MailinatorClient("yourApiTokenHere");
    
      //Get Team
      GetTeamResponse getTeamResponse = await mailinatorClient.StatsClient.GetTeamAsync();
    
      //Get TeamStats
      GetTeamStatsResponse getTeamStatsResponse = await mailinatorClient.StatsClient.GetTeamStatsAsync();
      // ...
    
Build with tests

Some of the tests require env variables with valid values. Visit tests source code and review TastBase.cs class. The more env variables you set, the more tests are run.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 694 2/23/2024
1.0.3 10,594 11/16/2023
1.0.2 44,047 8/12/2022
1.0.1 46,586 9/23/2020
1.0.0 5,813 9/17/2020