public static List <GuerrillaMail.Email> WaitEmail(this GuerrillaMail Email, Func <GuerrillaMail.Email, bool> Verify = null, int WaitMin = 10) { var Mails = new List <GuerrillaMail.Email>(); DateTime Limit = DateTime.Now.AddMinutes(WaitMin); while (Mails.Count == 0) { ThreadTools.Wait(10000, true); if (DateTime.Now > Limit) { throw new Exception("Timeout"); } if (Verify == null) { Mails = Email.GetAllEmails(); } else { Mails = Email.GetAllEmails().Where(Verify).ToList(); } } return(Mails); }
public static void ClearEmail(this GuerrillaMail Email, bool Wait = false) { Email.DeleteEmails((from x in Wait ? Email.WaitEmail() : Email.GetAllEmails() select x.mail_id.ToString())); }