TempMail
class · namespace z3n7.Api · source Mail/TempMail.cs
public class TempMail
Client of the Temp Mail service (Privatix) on RapidAPI. The mailbox id is the MD5 of the address; it is kept in tempMailId.
Constructors
TempMail
public TempMail(IZennoPosterProjectModel project, string apikey, bool log = false, bool useNetHttp = false, string proxy = "")
Creates a client.
| Parameter | Description |
|---|---|
apikey |
RapidAPI key; required. |
log |
Log requests and responses. |
useNetHttp |
Send requests through NetHttp instead of ZennoPoster's HTTP client. |
proxy |
Proxy in Rqst format; empty for none. |
Methods
CreateAddress
public static string CreateAddress(string login, string domain)
Joins login and domain into an address.
GetDomains
public string[] GetDomains()
Domains the service offers.
Returns: Throws when the list is empty.
GetHrefs
public HashSet<string> GetHrefs(int deadline = 120)
Waits for a message and collects the links of its HTML, skipping anchors, mailto:, tel:, javascript:, data: and links to images, styles, scripts and fonts.
| Parameter | Description |
|---|---|
deadline |
Seconds to wait; then TimeoutException. |
GetMail
public string GetMail(int deadline = 120)
Waits for a message, checking every 5 seconds.
| Parameter | Description |
|---|---|
deadline |
Seconds to wait; then TimeoutException. |
Returns: JSON of the first message.
GetMessages
public string GetMessages()
Current messages of the mailbox in tempMailId (else mailId), without waiting.
Returns: The raw JSON answer. Throws when no mailbox was created.
HashEmail
public static string HashEmail(string email)
MD5 of the lower-cased address, as hex: the mailbox id used by the service.
Link
public string Link(string urlPattern, int deadline = 120)
Waits for a message and returns the first match of urlPattern in its JSON, HTML-decoded.
| Parameter | Description |
|---|---|
urlPattern |
Regular expression. |
deadline |
Seconds to wait; then TimeoutException. |
Returns: The match. Throws when there is none.
NewMail
public string[] NewMail(string login = null, string domain = null)
Builds an address on a service domain; no request creates it, the service accepts mail for any login. Stores the id in tempMailId and mailId, the address in email and project.Profile.Email.
| Parameter | Description |
|---|---|
login |
Local part; random 10 hex characters when empty. |
domain |
Domain; a random service domain when empty. |
Returns: [md5, email].
Otp
public string Otp(int deadline = 120)
Waits for a message and returns the first 6-digit number of its subject, else of its text.
| Parameter | Description |
|---|---|
deadline |
Seconds to wait; then TimeoutException. |
Returns: The code. Throws when there is none.