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?

readMessage()

This feature allows you to open and read messages.

Description:

The Easy-YOPMail v4 readMessage() function allows developers to read the content of a specific email in the inbox of a YOPmail email address. This function is essential when you need to access the detailed content of an email, especially after identifying emails of interest using the getInbox() function.

Practical use:

Detailed reading of an email is crucial in situations such as:

Software testing: After receiving a confirmation or verification email, you can use readMessage() to access the contents of the email and, for example, extract verification codes or confirmation links.

Web scraping: By extracting data from emails received during a scraping process, this function allows programmatic access to the detailed content of those emails.

Example code:

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

let mailAddress = 'direccion_email';
let mailID = 'e_ZwZjAGVlZGHlZQR1ZQNjAwZ5AQp4ZD=='; // Tomado del resultado de getInbox()
let format = 'TXT'; // O 'HTML'
let selector = '#someHTMLSelector'; // Opcional

easyYOPmail.readMessage(mailAddress, mailID, format, selector).then(message => {
    console.log(message);
    // Ejemplo de salida:
    // {
    //   id: 'e_ZwZjAGVlZGHlZQR1ZQNjAwZ5AQp4ZD==',
    //   submit: 'Asunto del correo',
    //   from: 'Remitente',
    //   date: 'Fecha y hora',
    //   selector: '#someHTMLSelector',
    //   format: 'TXT',
    //   data: 'Contenido del correo...'
    // }
});            

Parameters and options:

The readMessage() function takes several parameters:

  • mail: The email address you want to read the message from.

  • id: The ID of the email to read, obtained from the result of getInbox().

  • format: The format in which you want to read the mail, can be 'TXT' or 'HTML'.

This is optional:

  • selector: An HTML selector to extract a specific segment of the mail. This is useful if only a specific part of the mail content is required.

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.

    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:

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.


AnteriordeleteInbox()SiguientewriteMessage()

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