static void Main(string[] args) { // To get a new temporary email var tempMail = new TempMailClient(); // To get all available domains var domains = tempMail.AvailableDomains; // To get Mailbox var mails = tempMail.GetMails(); // To change email to a specific login@domain tempMail.ChangeEmail("loginexample", domains[0]); // To get a new temporary email with a specific login@domain tempMail = new TempMailClient("loginexample", domains[0]); // To get a new temporary email with with login and random domain tempMail = new TempMailClient("loginexample"); // To delete current email and get a new one tempMail.Delete(); // To get the current email account string email = tempMail.Email; }
private static void Sample(TempMailClient client) { // To get the available domains var availableDomains = client.AvailableDomains; // To get the current email var email = client.Email; client.EmailChanged += (o, e) => Console.WriteLine($"Email changed: {e.Email}"); client.Inbox.NewMailReceived += (o, e) => Common.PrintMail(e.Mail); // Sends fake mails from your email to generated temporary email // Note: edit sender email credentials (email, password) // Note: you can use any free email sender service online instead Common.SendFakeMails(2, client.Email, 1000); // Checks for incoming mails every period of time client.StartAutoCheck(); // Wait for the mails to reach the temp-mail WaitForMailsToReach(client, 2, 1000); Common.SendFakeMails(1, client.Email, 1000); WaitForMailsToReach(client, 3, 1000); client.StopAutoCheck(); // give it 10s delay to make sure it reached temp-mail Common.SendFakeMails(1, client.Email, 10000, true); // Prints client session data like current email, mails, ...etc // Note: edit to print what you need Console.WriteLine("Only 3 mails, as we stopped auto check so we need to explicitly use refresh"); Common.PrintClientData(client); // To get all mails in mailbox client.Inbox.Refresh(); // To access mails var mails = client.Inbox.Mails; Console.WriteLine("4 mails (all mails)"); Common.PrintClientData(client); // To save attachments mails.ForEach(mail => mail.SaveAttachments()); // To change email to a specific login@domain client.ChangeEmail("loginexample", availableDomains[0]); // To delete email and get a new one client.Delete(); }
public void TestChangeEmail() { client.ChangeEmail("logintest", client.AvailableDomains[0]); Assert.AreEqual($"logintest{client.AvailableDomains[0]}", client.Email); }