DEV Community

Discussion on: Reading email data with Node.Js

Collapse
 
arbaz2002 profile image
Arbaz Khan

I am also facing the same problem how to solve it ???

Collapse
 
akinmyde profile image
Olumide Akinremi

Hello Arbaz,

You can use try/catch or .catch to handle errors. See the attached some code snippets that can help you handle errors.

Image description

Image description

Thread Thread
 
arbaz2002 profile image
Arbaz Khan

thank you sir how we will fetch the attachments from the email sir can you share this to me plz?????

Thread Thread
 
akinmyde profile image
Olumide Akinremi

You can get the attachment from the "parsed" object.

example is:

const {from, subject, textAsHtml, text, attachments} = parsed; 
Enter fullscreen mode Exit fullscreen mode

Check the mailparser documentation for more information

Thread Thread
 
arbaz2002 profile image
Arbaz Khan

thank you so much sir

Thread Thread
 
akinmyde profile image
Olumide Akinremi

You are welcome sir