mail-listener2 icon indicating copy to clipboard operation
mail-listener2 copied to clipboard

xlsx/xls attachments

Open sholtomaud opened this issue 11 years ago • 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?

sholtomaud avatar Jul 06 '14 08:07 sholtomaud

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

What error do you get?

chirag04 avatar Jul 08 '14 09:07 chirag04

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!

sholtomaud avatar Jul 08 '14 23:07 sholtomaud

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

sholtomaud avatar Jul 11 '14 08:07 sholtomaud

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 avatar Jul 13 '14 01:07 achannarasappa

@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 avatar Sep 09 '14 14:09 mailr

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

achannarasappa avatar Sep 12 '14 16:09 achannarasappa

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

m1sta avatar Oct 28 '14 08:10 m1sta