Easy-YOPMail v4
  • 💌Easy-YOPMail v4
  • 1️⃣getMail()
  • 2️⃣getInbox()
  • 3️⃣deleteInbox()
  • 4️⃣readMessage()
  • 5️⃣writeMessage()
  • 6️⃣deleteMessage()
Con tecnología de GitBook
En esta página
  • Description:
  • Practical use:
  • Example code:
  • Parameters and options:
  • Error and exception handling:
  • Limitations:

¿Te fue útil?

getInbox()

This feature allows you to explore and list emails in your inbox.

Description:

Easy-YOPMail v4's getInbox() function allows developers to access and list the inbox contents of any email address generated by YOPmail. This feature is essential if you need to check the emails received at a specific address, especially after performing actions such as registrations or confirmation requests.

Practical use:

Accessing and reading the inbox is critical in situations such as

Software testing: After registering an account or requesting a change to an application, it's common for a confirmation or verification email to be sent. With getInbox() you can quickly check if the mail has been received and access its contents.

Web scraping: By extracting data from websites that send information or confirmations via email, this function allows you to access those emails programmatically.

Example code:

const easyYOPmail = require('easy-yopmail');

let mailAddress = 'direccion_email';
let searchParams = {};
let settings = {};

easyYOPmail.getInbox(mailAddress, searchParams, settings).then(inbox => {
    console.log(inbox);
    // output example:
    // {
    //   settings: {},
    //   search: {},
    //   totalInbox: 271,
    //   totalPages: 19,
    //   mailFromPage: { page_1: 15 },
    //   totalGetMails: 15,
    //   inbox: [
    //     {
    //       id: 'e_ZwZjAGVlZGHlZQR1ZQNjAwZ5AQp4ZD==',
    //       from: 'Ola no-reply',
    //       subject: 'this is example message...',
    //       timestamp: '10:20'
    //     }
    //   ]
    // }
});

Parameters and options:

The getInbox() function takes at least one parameter:

  • mailAddress: An string the email address you want to retrieve the inbox from.

  • search: An object that can contain search criteria to filter the emails in the inbox.

['id', 'from', 'subject', 'timestamp']
let searchParamsById = {id: 'e_ZwZjAGVlZGHlZQR1ZQNjAwZ5AQp4ZD=='};
let searchParamsByFrom = {from: 'Ola no-reply'};
let searchParamsBySubject = {subject: 'this is example message...'};
let searchParamsByTimestamp = {timestamp: '10:20'};

Settings: An object that can contain additional settings for the query. There is still no more detail on this parameter.

Error and exception handling:

If the email address does not exist, the required parameters are not provided, or there is some other problem accessing the inbox, the function will return an error. It is important that you handle these errors correctly in your code to avoid interrupting execution.

Limitations:

This function does not read the mail directly, but gets a list of all incoming mail and extracts the ID needed to read the mail.


AnteriorgetMail()SiguientedeleteInbox()

Última actualización hace 1 año

¿Te fue útil?

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
2️⃣
Page cover image