chirag04/mail-listener2

xlsx/xls attachments

Opened this issue · 7 comments

I'm having trouble parsing excel spreadsheets - would you be able to provide a best practice example of how to deal with an email that has an xls attachment?

There are no extension specific guidelines for attachments. xls should work as with other files.

What error do you get?

I'm not getting an error as such. More the absence of any error or any file with xls or xlsx.

This is to say that no file is produced.

My aim is to parse the xls/xlsx attached file with xlsjs and store the results.

if you have anything like an example it would be awesomeballs!

Is there a debugging setting which might tell me why I can't save my xls/xlsx?

Attachments are not automatically saved. You need to save the buffer for the given attachment in the attachments array.

See MailParser documentation and nodejs file system api

@achannarasappa the test script has the following lines:

  attachments: true, // download attachments as they are encountered to the project directory
  attachmentOptions: { directory: "attachments/" } // specify a download directory for attachments

Are there any other settings?

@mailr Those are the only settings you need to set. Make sure the directory attachments exists relative to the project directory.

It appears that attachments won't be saved into the folder if streamAttachments: true is set (as it is in the example). Which makes sense, since if you set this flag you want a stream and not a file :)