# getMail()

## Description:&#x20;

Easy-YOPMail v4's `getMail()` function allows developers to dynamically generate random email addresses. This feature is especially useful when you need a unique and temporary email address without having to interact with a web interface or perform any additional configuration.

## Practical use:&#x20;

Dynamic email generation is essential in many situations, such as

**Software testing:** During testing, it is often necessary to fill in forms that require an email address. Instead of using a real address or creating one each time, `getMail()` returns a unique and valid address in seconds.

**Web scraping:** When extracting data from web pages that require registration, this function simplifies the process by automatically generating an email address for each registration, thus avoiding blocks or restrictions.

## Example code:

```javascript
const easyYOPmail = require('easy-yopmail');
easyYOPmail.getMail().then(mail => {
    console.log(mail); 
    // Ejemplo de salida:
    // jemuzivutro-3233@yopmail.com
});
```

## **Parameters and options:**

The `getMail()` function takes no additional parameters. Each call to this function guarantees the generation of a unique email address; the same email will never be repeated.

## **Error and exception handling:**

The function can have two possible outcomes:

* **Success**: Generates and returns a random email address.
* **Error**: If it cannot generate the mail, it will return a 400 error indicating that it cannot generate the mail.

## **Limitations:**

While the Easy-YOPMail v4 library has no specific limitations on email generation, it is important to note that limitations may be imposed by the YOPmail platform. However, in practice these limitations rarely affect the normal use of the library.

***

Do you find this format and content suitable for documentation? If there is anything you would like to improve or add, please let me know. <https://github.com/jasp402/Easy-YOPmail/issues/new/choose>

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jasp402.gitbook.io/easy-yopmail-v4/getmail.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
