Closed Vinodkomeershetty closed 2 years ago
I am not able to find a way to read the message of the emails, can you please help me out how to acheive
use the inbox to get the _id of the mail you want to read. use the second parameter to filter by subject or content
const easyYOPmail = require('easy-yopmail');
easyYOPmail.inbox('abc@yopmail.com').then(inbox=>{
console.log(inbox);
});
//respuesta
/*
[
{
id: 'e_ZwRkZGV5ZQNmAQZ4ZQNjZQR5BGH3BN==',
time: '19:34',
subject: 'insightalertstest@gmail.com',
content: 'Daily Statistics For Portal: hi'
},
{
id: 'e_ZwRkZGV5ZQNmAQZ1ZQNjZQR5BGV4ZD==',
time: '19:34',
subject: 'insightalertstest@gmail.com',
content: 'ポータルの日次統計: どういたしまして'
},
{
id: 'e_ZwRkZGV5ZQNmAQV4ZQNjZQR5BQp1ZD==',
time: '19:34',
subject: 'insightalertstest@gmail.com',
content: 'Daily Statistics For Portal: Insight'
},
{
id: 'e_ZwRkZGV5ZQNmAQV0ZQNjZQR5BQD2BN==',
time: '19:34',
subject: 'insightalertstest@gmail.com',
content: 'Daily Statistics For Portal: maint beta'
},
{
id: 'e_ZwRkZGV5ZQNmAQR4ZQNjZQR5BQRmZt==', <-------------------------- USE THIS ID
time: '19:34',
subject: 'Lee Arnold', <-------------------------------------------------------------- READ THIS!
content: 'I want to send you your money back'
}
]
*/
easyYOPmail.readMessage('abc@yopmail.com', 'e_ZwRkZGV5ZQNmAQR4ZQNjZQR5BQRmZt==').then(mail => {
console.log(mail)
});
reading an email generates a default HTML file (see image) result
But you can get just the text content or you can use HTML selectors to extract a specific section. You can review the documentation at https://jasp402.gitbook.io/easy-yopmail/methods/messages/read-message-1
If the information is not enough or you have any other problem, do not hesitate to consult.
Sample Snippet
// const constants = require('../constants/constants.app'); const easyYopmail = require('easy-yopmail'); // const assert = require('assert'); // const fs = require('fs');
const k= async function(){ const inbox = await easyYopmail.getInbox("abc@yopmail.com", {}, {MAX_PAGE:1}); //Below code is not working // const inbox1 = await easyYopmail.readMessage("abc@yopmail.com"); await console.log(JSON.stringify(inbox)) // await console.log(JSON.stringify(inbox1)) // await console.log(inbox1) // await console.log(inbox1) }