Skip to content

Commit 92bf730

Browse files
committed
2 parents 24a04a0 + bbed0d5 commit 92bf730

File tree

2 files changed

+88
-39
lines changed

2 files changed

+88
-39
lines changed

README.md

Lines changed: 86 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,84 +3,133 @@ Temp-Mail-API
33
[![NuGet](https://img.shields.io/nuget/v/TempMail.API.svg?maxAge=60)](https://www.nuget.org/packages/TempMail.API)
44
===============
55

6-
Unofficial API for [TempMail](https://temp-mail.org) in .NET
6+
Unofficial API Client Library for [TempMail](https://temp-mail.org) in .NET Standard
77

88
> Disposable email - is a service that allows to receive email at a temporary address that self-destructed after a certain time elapses. It is also known by names like : tempmail, 10minutemail, throwaway email, fake-mail or trash-mail. Many forums, Wi-Fi owners, websites and blogs ask visitors to register before they can view content, post comments or download something. Temp-Mail - is most advanced throwaway email service that helps you avoid spam and stay safe.
99
10-
**NuGet**: https://www.nuget.org/packages/TempMail.API
10+
# Installation
1111

12+
`PM> Install-Package TempMail.API`
1213

1314
# Usage
1415

15-
Synchronous Example
16+
- #### Initialize Client
17+
_Creates and initializes a new temp-mail client with a temporary email_
1618

1719
```csharp
20+
var client = TempMailClient.Create();
21+
```
22+
23+
```csharp
24+
var client = await TempMailClient.CreateAsync();
25+
```
1826

19-
var client = new Client();
27+
- #### Current Email
28+
_Gets current temporary email_
29+
```csharp
30+
var email = client.Email;
31+
```
2032

21-
// To get a new temporary email
22-
client.StartNewSession();
33+
- #### Available Domains
34+
_Gets available domains_
2335

24-
// To get the available domains
36+
```csharp
2537
var availableDomains = client.AvailableDomains;
38+
```
2639

27-
// To get Mailbox
28-
var mails = client.Inbox.Refresh();
40+
- #### Change Email
41+
_Changes the temporary email to a specific email (ex: login@domain)_
2942

30-
// To change email to a specific login@domain
31-
client.Change("loginexample", availableDomains[0]);
43+
```csharp
44+
client.ChangeEmail("loginexample", availableDomains[0]);
45+
```
46+
```csharp
47+
await client.ChangeEmailAsync("loginexample", availableDomains[0]);
48+
```
49+
50+
- #### Delete
51+
_Deletes the temporary email and gets a new one_
3252

33-
// To delete email and get a new one
53+
```csharp
3454
client.Delete();
55+
```
56+
```csharp
57+
await client.DeleteAsync();
58+
```
3559

36-
// To get the current email
37-
var email = client.Email;
60+
- ### Refresh
61+
_Gets all mails in mailbox_
3862

63+
```csharp
64+
var mails = client.Inbox.Refresh();
65+
```
66+
```csharp
67+
var mails = await client.Inbox.RefreshAsync();
3968
```
4069

41-
Asynchronous Example
70+
- #### Mailbox
71+
_Gets all mails in mailbox (doesn't update from temp-mail)_
4272

4373
```csharp
74+
var mails = client.Inbox.Mails;
75+
```
4476

45-
var client = new Client();
77+
- #### Inbox Auto Check
78+
_Checks for incoming mails every period of time_
4679

47-
// To get a new temporary email
48-
await client.StartNewSessionAsync();
80+
```csharp
81+
client.StartAutoCheck(delay: 10000); // default delay is 10s
82+
```
4983

50-
// To get the available domains (not async)
51-
var availableDomains = await Task.Run(() => client.AvailableDomains);
84+
```csharp
85+
client.StopAutoCheck();
86+
```
5287

53-
// To get Mailbox
54-
var mails = await client.Inbox.RefreshAsync();
88+
- #### Events
5589

56-
// To change email to a specific login@domain
57-
await client.ChangeAsync("loginexample", availableDomains[0]);
90+
_Occurs when the temporary email changes_
5891

59-
// To delete email and get a new one
60-
await client.DeleteAsync();
92+
```csharp
93+
client.EmailChanged += (o, e) => Console.WriteLine($"Email changed: {e.Email}");
94+
```
6195

62-
// To get the current email
63-
var email = client.Email;
96+
_Occurs when a new mail is received by client_
6497

98+
```csharp
99+
client.Inbox.NewMailReceived += (o, e) => Console.WriteLine($"\tSender: {e.Mail.SenderName}\n\tSubject: {e.Mail.Subject}\n\tBody: {e.Mail.TextBody}");
65100
```
66101

67-
To use a Proxy, if your IP is banned by Cloudflare
102+
# Additional Features
103+
104+
- #### Cloudflare Protection
105+
Website sometimes uses Cloudflare protection, so we use [CloudflareSolverRe](https://www.nuget.org/packages/CloudflareSolverRe) to bypass it.
106+
107+
Sometimes Cloudflare forces captcha challenges or Js challenge cannot be solved, so we need to use [CloudflareSolverRe.Captcha](https://www.nuget.org/packages/CloudflareSolverRe.Captcha) package to bypass it using (2captcha or AntiCaptcha)
108+
68109
```csharp
69-
var client = new Client(proxy: new WebProxy("163.172.220.221", 8888));
110+
var client = TempMailClient.Create(
111+
captchaProvider: new AntiCaptchaProvider("YOUR_API_KEY"));
70112
```
71113

72-
To add your 2captcha api key, if cloudflare challenge is a captcha
73114
```csharp
74-
var client = new Client(_2CaptchaKey: YOUR_2CAPTCHA_KEY);
115+
var client = TempMailClient.Create(
116+
captchaProvider: new TwoCaptchaProvider("YOUR_API_KEY"));
117+
```
118+
119+
_for more information read the documentation here [CloudflareSolverRe](https://github.com/RyuzakiH/CloudflareSolverRe)_
120+
121+
- #### Proxy
122+
123+
```csharp
124+
var client = TempMailClient.Create(
125+
proxy: new WebProxy("163.172.220.221", 8888));
75126
```
76127

77-
Full Test Example [Here](https://github.com/RyuzakiH/Temp-Mail-API/blob/master/src/TempMail.Example/Program.cs)
128+
Full Examples [Here](https://github.com/RyuzakiH/Temp-Mail-API/tree/master/sample/TempMail.Sample)
78129

79130
# Supported Platforms
80131
[.NET Standard 1.3](https://github.com/dotnet/standard/blob/master/docs/versions.md)
81132

82133
# Dependencies
83-
* [HtmlAgilityPack](https://www.nuget.org/packages/HtmlAgilityPack)
84-
* [MimeKit](https://www.nuget.org/packages/MimeKit)
85-
* [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json)
86-
* [CloudflareSolver](https://www.nuget.org/packages/CloudflareSolver)
134+
* [CloudflareSolverRe](https://www.nuget.org/packages/CloudflareSolverRe)
135+
* [MimeKitLite](https://www.nuget.org/packages/MimeKitLite)

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
version: 2.0.0
1+
version: 2.0.{build}
22
image: Visual Studio 2017
33
before_build:
44
- dotnet restore
55
build_script:
66
- dotnet build /verbosity:quiet "TempMail-API.sln"
77
test_script:
8-
- dotnet test --no-build .\test\TempMail.Tests\TempMail.Tests.csproj
8+
- dotnet test --no-build .\test\TempMail.Tests\TempMail.Tests.csproj

0 commit comments

Comments
 (0)