Giter Site home page Giter Site logo

mail.tm's Introduction

mail.tm

A mail.tm / mail.gw API wrapper for .NET. These services have identical api at the moment, but this might change in future.

Installation

Available as a NuGet.

PM> Install-Package SmorcIRL.TempMail

Getting started

Introduction

mail.tm is a great temporary/disposable mail service, and also recently was launched a new 10 minute mail service called mail.gw. As I said, these two services have identical api, so all told about mail.tm will be true for mail.gw as well. Basically API calls require authorization, but some are not (getting domains info, for example). Having an authorized MailClient instance, you can get its authorization token via BearerToken property, that may be helpfull for manual debbuging using Swagger.

Register

Interaction with account API is performed through a MailClient instance. You can simply register like this

MailClient client = new MailClient();
await client.Register("[email protected]", "*password*");

You can also specify the base api url. The default refer to mail.tm, but if you want to use mail.gw, create a client like that

MailClient client = new MailClient(new Uri("https://api.mail.gw/"));

Make sure you specify the domain correctly - domains list is limited by the service. You can get an actual list using

DomainInfo[] domains = await client.GetAvailableDomains();

If you only need to get any valid domain name for you account

string domain = await client.GetFirstAvailableDomainName();

Now you can register using an overload that takes email and domain separately

string domain = await client.GetFirstAvailableDomainName();
await client.Register("pepethefrog", domain, "*password*");

Log in

If you already have an account, you can log in using your creds

await client.Login("[email protected]", "*password*");

Get account info

If you need to get info about the account you are using, like creation date or message quota, call

AccountInfo info = await client.GetAccountInfo();

Delete account

After your work with the account is done, you can delete it

await client.DeleteAccount();

After that you can reuse the client with new authorization via Login()/Register() if needed.

Working with messages

  • Get info about all messages
MessageInfo[] messages = await client.GetAllMessages();
  • Get info about all messages from the page
MessageInfo[] messages = await client.GetMessages(*page*);
  • Get message info by id
MessageInfo message = await client.GetMessage("*id*");
  • Get message source
MessageSource source = await client.GetMessageSource("*id*");
string rawMessage = source.Data;
  • Mark as seen
await client.MarkMessageAsSeen("*id*", true);
  • Delete
await client.DeleteMessage("*id*");

mail.tm's People

Contributors

smorcirl avatar tiephoangdev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.