Coder Social home page Coder Social logo

Comments (9)

eliottvincent avatar eliottvincent commented on July 2, 2024 2

Hey! Thanks for using this library and reporting your issue. Two things here:

  • you're passing the body as raw HTML, for optimal results this library only accepts a text body. If you use mailparser, you must use the text property from the email object. I think you're passing the html property right now. I've updated the README to make things more clear.
  • there was also a bug in the code, I've fixed it in version v1.0.17. The library will not crash anymore, even if you pass HTML.

Regarding your example, I don't have it in my tests, so maybe some information will not be parsed. Maybe you can give me a copy of the text output from mailparser, so I can add it to my tests.

Let me know if thinks works for you now :)

from email-bounce-parser.

eliottvincent avatar eliottvincent commented on July 2, 2024 1

I have released version 1.0.18 that improves parsing for the Outlook example you gave me, thanks.

Let me know if you have other examples that are not correctly parsed (this library is only a few days old 😀 )

from email-bounce-parser.

sarangpatel avatar sarangpatel commented on July 2, 2024

image

from email-bounce-parser.

sarangpatel avatar sarangpatel commented on July 2, 2024

html is parsing from this library - https://nodemailer.com/extras/mailparser/

from email-bounce-parser.

sarangpatel avatar sarangpatel commented on July 2, 2024

Thanks alot @eliottvincent worked :)
Just wanted to confirm 2 things:
bounce: true --> If its a bounched email right?
data. recipient -> will always contain the bounced email?

PS: Attached is outlook text body for tests.
outlook_bounce.txt

from email-bounce-parser.

eliottvincent avatar eliottvincent commented on July 2, 2024

bounce: true --> If its a bounched email right?
Remember that this library doesn't detect bounce emails. It only parses them. So you need to make sure to pass bounce emails only. I guess that you receive bounce emails on a specific email address (like [email protected]). You need to only pass emails that arrive to this email address.
If you pass other kind of emails, you may end up with misleading results. bounce: false only happens if you pass an empty body to the parser (check here).

data. recipient -> will always contain the bounced email?
From what I can tell, yes. I never saw a bounce email without the recipient email address inside.

Thanks for the Outlook body, I will update the library tomorrow!

from email-bounce-parser.

sarangpatel avatar sarangpatel commented on July 2, 2024

thanks for the detail. But, the thing is, we don't have separate email for receiving bounce emails.

the field error.code ie bounce error codes, we can use to bifurcate normal vs bounce email?

from email-bounce-parser.

eliottvincent avatar eliottvincent commented on July 2, 2024

I highly recommend you to have a dedicated email address for bounces and then only parsing the mails that reach this email address.

You can use the error.code yes, but if you receive an email with 550 inside, it will be treated as a bounce, whereas it's clearly not.
What you could do is check for data.error.code + data.recipient, although you may have some false positives as well.

from email-bounce-parser.

sarangpatel avatar sarangpatel commented on July 2, 2024

got it @eliottvincent thanks

from email-bounce-parser.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.