mscdex / node-imap

An IMAP client module for node.js.
MIT License
2.14k stars 379 forks source link

MD5 field not populated #880

Closed luixal closed 2 years ago

luixal commented 2 years ago

Hi,

I would like to get the md5 hash from attached files, but my attachment objects look like this:

{
  partID: '2',
  type: 'application',
  subtype: 'vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  params: { name: 'south_summit_talks.xlsx' },
  id: null,
  description: 'south_summit_talks.xlsx',
  encoding: 'base64',
  size: 43530,
  md5: null,
  disposition: {
    type: 'attachment',
    params: {
      filename: 'south_summit_talks.xlsx',
      size: '39905',
      'creation-date': 'Mon, 13 Jun 2022 07:24:17 GMT',
      'modification-date': 'Mon, 13 Jun 2022 07:24:21 GMT'
    }
  },
  language: null,
  location: null
}

the md5 field is always null. I'm connecting to an Outlook server via IMAP, not sure if it's related to server config.

Any idea how can I get this field populated?

I've been looking around the docs for this, but haven't found any reference. If I missed something, please, just redirect me there :)

Thanks!

mscdex commented 2 years ago

It's only populated if the message/server has it populated, it's not something that is automatically calculated by imap.

luixal commented 2 years ago

Totally true. After investigation a little further I found that this field has to be populated by the client sending the email with the attached file but, according to what I've read, almost none does it by default.

I finally calculated it myself while streaming the attachment.

Thanks!