Pranav-Dakshina / mail-listener2

Mail listener library for node.js. Get notification when new email arrived.
Other
3 stars 7 forks source link

mail-listener4 how to download attachment file ? #2

Open VivekPowar opened 5 years ago

VivekPowar commented 5 years ago

also attachment.path is undefined mailListener.on("attachment", function(attachment){ console.log(attachment.path); });

MateMalice commented 5 years ago

Hi Vivek,

If you're using a newer version of Node that supports ES6+ features, you might want to try my fork (Which will eventually get merged as per the open pull request) - that one does not seem to have this problem, though it buffers attachments rather than streaming them so it might use lots of RAM for large files.

See here: https://github.com/MatejMalicek/mail-listener2

Cheers,

M

VivekPowar commented 5 years ago

Thanks @MatejMalicek it's working fine now, but the issue is in attachments .msg (Outlook mail) file extension is not downloading also its not give the filename also in attachments array. So can you help me for that file extension download.

MateMalice commented 5 years ago

Hi Vivek,

Sorry for the late reply - I've been quite busy over the last week.

So that I can investigate the issue, could you please confirm the following:

It may well be a bug in the mail parser that's treating the .msg files as actual emails, rather than attachments, but it'll be hard for me to isolate the problem without more information. Info about the environment you're using (i.e. Node version, OS, etc.) and steps to reproduce are particularly important, as if you provide this, I might be able to reproduce the problem myself & identify the root cause without needing your logs, etc.

Once you provide this info, I'll have a look at it when I get the time. :-)

Cheers,

Matej

azaitw commented 5 years ago

Add this option: mailParserOptions: { stream: true }

(Suggest adding this into README.md)

Pranav-Dakshina commented 5 years ago

@VivekPowar I guess @azaitw answered your question. Let me know otherwise, we can dig deeper into the issue.