DotNet API for creating and managing temporary emails based on 1secMail.
Using:
using OneSecEmailDotNet.Core;
Create instance of EmailService:
using (var es = new EmailService(/*optional: proxy*/))
{
//do your work
}
Create new email address:
using (var es = new EmailService(/*optional: proxy*/))
{
//Create 1 mailbox
var mailbox = await es.CreateAsync();
//Create 5 mailboxes
var mailboxes = await es.CreateAsync(5);
}
Get message by ID:
await es.GetMessageByIdAsync(mailbox, 123);
Download attachments:
await es.DownloadAttachmentAsync(email, message.Id, attachment.FileName);
Example update:
while (!await es.ContainsNewMessagesAsync(mailbox))
{
//check every 20 sec
await Task.Delay(1000 * 20);
}
//email auto update
await es.UpdateEmailAsync(mailbox);
Or do it manualy with:
GetNewMessagesId(...);
GetMessageByIdAsync(...);
Dispose after done:
es.Dispose();