jasp402 / Easy-YOPmail

📮 YOPmail emails manager from an NPM NodeJS library
https://jasp402.github.io/Easy-YOPmail/starter-topic.html
19 stars 3 forks source link

Yopmail- Sender object info is shown in Subject and Subject info shown in content , no way to access mail body #3

Closed Vinodkomeershetty closed 2 years ago

Vinodkomeershetty commented 3 years ago

image

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) }

k();
Vinodkomeershetty commented 3 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

jasp402 commented 2 years ago

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) image result image

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 image

If the information is not enough or you have any other problem, do not hesitate to consult.