jasp402 / Easy-YOPmail

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

Attached files in read message #14

Open ArthurGlacetAdeo opened 4 months ago

ArthurGlacetAdeo commented 4 months ago

Hello,

It seems to me that the readMessage function does not return attached files. it would be nice to be able to get thoses as well. The link of the attached file is present on the mail and then be able to download it.

jasp402 commented 4 months ago

Hello, it is an improvement that we are working on to be included in version 5. Along with the possibility of obtaining the images that come in the emails.

I am going to leave this ticket open until version 5 is released and validate that this option works correctly. Thank you for using Easy-YOPmail

jasp402 commented 3 months ago

Hi,

Don't think I don't remember you. In Easy-Yopmail 5.1.0, we have a new property: "Attachments." Now we can get attachments by mail using Easy-Yopmail.

When the email has no attachments:

{
  id: 'e_ZwDjAwN3ZGDlAwH1ZQNjAGD1ZwxmAj==',
  submit: 'sin adjunto',
  from: 'Jasp402 <jasp402@gmail.com>',
  date: 'Friday, June 07, 2024 9:26:55 AM',
  deliverability: 'Your account has been credited',
  attachments: {}, // it's an empty object
  format: 'txt',
  selector: null,
  eq: null,
  attribute: null,
  pathToSave: null,
  content: 'prueba de correo sin adjunto',
  info: []
}

But when the email receives an attachment:

{
  id: 'e_ZwDjAwN3ZGDjBGHjZQNjAGZkAwVjZj==',
  submit: 'prueba con adjunto',
  from: 'Jasp402 <jasp402@gmail.com>',
  date: 'Friday, June 07, 2024 9:09:50 AM',
  deliverability: `"gmail.com" doesn't seem to be the real sender of this message`,
  attachments: {
    fullName: 'adjunto.rar',
    name: 'adjunto',
    extension: 'rar',
    file: 'https://yopmail.com//cid?b=jasp402&id=e_ZwDjAwN3ZGDjBGHjZQNjAGZkAwVjZj==&cd=a&pj=f_lx4ridxa0'
  },
  format: 'txt',
  selector: null,
  eq: null,
  attribute: null,
  pathToSave: null,
  content: 'Correo con un archivo adjunto en .rar',
  info: []
}

The property "attachments" has:

NOTES: I don't know the capabilities of Yopmail in terms of weight to support attachments.

I don't know if there is any type of re-captcha for attachments. The tests were carried out with small files, PDF, and ZIP. I don't know what other formats it supports or if there are any preconditions.

That being said, handle with care.

ArthurGlacetAdeo commented 2 months ago

finally had time to test it!

it works fine but i can't download the file using a simple get as it returns an HTTP400 due to the lack of cookies... Could you add a way to download the attachement ?

jasp402 commented 2 months ago

I am glad to know that you have been able to use it.

At the time, I made a test circuit; however, it is possible that I did not have a test case like yours. Please share your test case with us so we can try to replicate it.

As I mentioned earlier, I was only able to test with small files in PDF and ZIP formats.

ArthurGlacetAdeo commented 2 months ago

i just try to download a pdf attached file. if i follow a attachement file dowload URL from a incognito browser i'm getting an HTTP400.

Same if a make a get api call.

for exemple following the URL from an incognito web browser: yopmail.com/cid?b=test.yopmail&id=e_ZwDjAwV0ZGDkZmH1ZQNjAwN5AmH5BN==&cd=a&pj=f_lxt22ugv0

image

( i think it's beacause the lack of cookies )

jasp402 commented 1 month ago

I'm going to be revisiting this case this week. Since it's an API, the correct thing to do would be to return the binary. However, this represents a security breach, as I have no way of identifying malicious code.

The short cut is to download the file locally where the project is running and make the path available. And since there is a risk, the user must activate the getAttachment option so that the attached content can be included.