Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback: why and how are you using this lib? #15

Open
willdurand opened this issue Dec 3, 2013 · 42 comments
Open

Feedback: why and how are you using this lib? #15

willdurand opened this issue Dec 3, 2013 · 42 comments
Labels

Comments

@willdurand
Copy link
Owner

Hi!

I must admit that I never used this library myself, I just took a couple hours to port the GitHub's email_reply_parser library because it looked cool. Earlier this week, I decided to read the code again, and it was quite awful, so I refactored the lib, and I shipped 2.0.0. I hope you will like it.

Anyway, if you are a user, I'd love to hear from you! Could you please write a comment below, telling me more about your use cases, why and how you are using this lib, and maybe some ideas or things you would love to see in it?

❤️ Thank you! ❤️

Will

@willdurand
Copy link
Owner Author

Doh! No comment yet.

@soundslocke
Copy link

We're using it! It is crucial piece in a system that, similar to GitHub and other services, allows users to reply to email notifications/messages and have their replies inserted back into our messaging system (after being parsed thanks to your library).

What I have found is that your library does about 95% of the parsing work. The other 5% would be the extra handling for edge cases and poorly formatted emails that are frequently sent in the Real World™. Over the course of the past several months we've collected the major offender patterns and run an extra series of 10 or so preg_replace() calls after your library has run in order to filter all those misc pieces out as well.

For a future idea, figuring out a way to handle these cases in the library would be handy. Perhaps an extra "trim liberally" option that can tell the class to incorporate a bunch of these regex patterns and filter them out automatically. Or perhaps a way to pass a series of extra regex strings for the library to look for.

Anyhow, thanks for the library and keep up the great work!

@willdurand
Copy link
Owner Author

@soundslocke thank you for your feedback, much appreciated ❤️

Adding a way to hook into the parsing process sounds like a really good idea, and if you have ideas on how to introduce such a feature in the lib, please don't hesitate to submit a patch, even if it is just a draft :)

@andheiberg
Copy link

@soundslocke could you perhaps paste your regexs? So that we can learn from it :-)

@willdurand I will start using your lib right now. I have a messaging system on my website and would like people to be able to respond from their email client.

I have some future features where people will be able to perform actions on notifications from their email.

@soundslocke
Copy link

Sure, though I can't paste all of them because they are specific to us. Here are the more common ones I can share though:

$parsed_message = preg_replace('/\n(\s?)In a message dated(.*?)$/si', '', $parsed_message);
$parsed_message = preg_replace('/-----Original Message-----(.*)/si', '', $parsed_message);
$parsed_message = preg_replace('/-------- Original Message --------(.*)/si', '', $parsed_message);
$parsed_message = preg_replace('/Sent from my Verizon Wireless Smartphone(.*)/si', '', $parsed_message);
$parsed_message = preg_replace('/Sent from my Galaxy(.*)/si', '', $parsed_message);
$parsed_message = preg_replace('/Sent from my PANTECH(.*)/si', '', $parsed_message);

@andheiberg
Copy link

Thanks

@yosmanyga
Copy link

I'm using your library in a CRM, to extract the real content of messages from customers. Then the system updates conversations in database. Operators can see messages and reply from a backend.

It would be nice to have a feature to clean subject, e.g.: remove Re:.

@bjornpost
Copy link
Contributor

We are a user experience/research firm and use your product in combination with tedivm/fetch to parse incoming e-mails from research participants. Since most people here are sharing their solution for custom regular expressions, thought I'd share ours here as well. We chose not to do some additional parsing afterwards, but extend the library like this: https://gist.github.com/bjornpost/c4873ba9690b3ca15d66

It would be nice though if it wouldn't require subclassing 2 classes, but instead just load another parser from the EmailReplyParser class.

@andheiberg
Copy link

@bjornpost fetch looks interesting... does it simply give you all unread messages in the inbox? and then mark them read?

@bjornpost
Copy link
Contributor

@willdurand
Copy link
Owner Author

Nice, thank you!

@willdurand
Copy link
Owner Author

Injecting a new parser looks like a nice improvement :)

@willdurand willdurand added the DX label Jun 26, 2014
@lsv
Copy link

lsv commented Sep 18, 2014

I have waited pretty long for a project where I could use it actually - and now it came.

Though its just for internal fun, for our "send a email to our office screen".

But I can see there are missing a pretty crucial test, UTF8 characters there are converted to ISO-8859-1 (or the other way round) - this gives some very strange characters.

I will fork and create a test fixture for this and see if it fails :)

@willdurand
Copy link
Owner Author

@lsv yep, don't hesitate to create a Pull Request with either tests or tests + patch :-)

@lsv
Copy link

lsv commented Sep 18, 2014

@willdurand ohh, I forgot that it was the subject that have trouble with ISO-8859-1 > UTF-8

protected $subject =>
    string(37) "Heja med =?UTF-8?B?w6bDuMOlIGRpZw==?="

(should be) Heja med æøå dig

So well its out of this repos scope :)

@pbrzoski
Copy link
Contributor

pbrzoski commented Jan 9, 2015

Is exist any parser for email forward ?

@cristobal-wetzig
Copy link

You rock!

We use this in combination with postmarkapp service to extract the signatures from incomming mail.

I noticed you have french support in the regexp. How about swedish? Or some way to add them.

example from apple mail client:
5 mar 2015 kl. 12:03 skrev {joe}

@pbrzoski
Copy link
Contributor

pbrzoski commented Mar 5, 2015

If you want, you can create pull request with swedish.

Regexps for other language, are in file
src/EmailReplyParser/Parser/EmailParser.php

@willdurand
Copy link
Owner Author

Yes, adding swedish is ok. But there is also a method for that IIRC.

@willdurand
Copy link
Owner Author

Thanks for the kind words btw :)

@cristobal-wetzig
Copy link

@willdurand m8 if you ever in Stockholm, a cold beer is waiting for you.

@rmccue
Copy link

rmccue commented Oct 1, 2015

I've been using EmailReplyParser for quite a while now, but must have missed this issue previously!

We're using it in a WordPress plugin called Falcon that allows people to reply by email. Super handy when using a WordPress site as an internal company message board (with something like P2).

EmailReplyParser means we can have minimal effort when replying for a basically seamless integration. Thanks for maintaining this. ❤️

@miladr
Copy link

miladr commented Nov 16, 2015

I'm going to use it for our ticketing service.
As you may know major services like Zendesk use a string like "## Please type your reply above this line ##" and when user click reply button this string is above all quoted lines.
It's a good idea to accept a string and put all below lines in a quoted fragment.

@lflaszlo
Copy link

Hi, thanks for your work on this lib.

We use this lib for our internal ticketing system, we parse emails inputs directly to tickets and we "clean" these emails thanks to EmayReplayParser.

Regards,

@perajovic
Copy link
Contributor

We use it as a very important component of our SaaS business -- https://supportyard.com. And we love it!

@willdurand
Copy link
Owner Author

Thank you for your replies.

@SGudbrandsson
Copy link
Contributor

I use it in our production code to parse e-mail messages.
It's immensely valuable, but I may need to add more detection scenarios for more languages since we deal with a lot of different languages.

@dbr0
Copy link

dbr0 commented Jan 3, 2017

We use it in our ticketing system to parse the replies we get through emails.

@voicecode-bv
Copy link

Thank you so much for this! Amsterdam is very happy with your work. Using this to send chatbox messages via email.

@willdurand
Copy link
Owner Author

Dear users, 2.6.0 is out today. Thanks!

@thebordella
Copy link

This class looks great! Question though - we need something like this to parse e-mail replies inbound from Sendgrid. We want to extract just the reply and not all the quoted content in the chain.

But this class only parses plaintext email, right? When users reply they are using their own mail clients. I know that Sendgrid provides the plaintext content if available, and in my tests I see that Gmail and Thunderbird do by default include the plaintext alternative. But I don't know whether to assume most email clients will.

What do people do about this? How do we best ensure we can feed plaintext replies into this parser? Thank for any advice!

@spidgorny
Copy link

@thebordella

$plain = html_entity_decode(
    trim(
        strip_tags($html)
    )
);

@SL-Gundam
Copy link
Contributor

Hi

I'm a developer for the EmailReporting project which is a plugin for MantisBT.

I'm planning to use this library to process incoming emails more effectively and create better tickets or notes for MantisBT

I'm already using Markdownify to process html emails to markdown. I wonder how well EmailReplyParser handles that content. We'll see. If succesfull this will retire more simple existing code in EmailReporting

@harikt
Copy link

harikt commented Mar 16, 2018

Hi @willdurand ,
I am not using it myself, but was trying to help someone. As others already mentioned, it is to make it similar to github notification reply to email sort of stuff.

  1. Probably finding attachments would be a nice feature.
  2. As already mentioned attaching more parsers would be a nice feature to have.

@billynoah
Copy link

billynoah commented Mar 21, 2018

Using this to import emails into a ticket and rma system. Had written something close myself until I realized how many various formats are in play. A quick search brought me here from this stackoverflow answer.

Your work is much appreciated!

@barryvdh
Copy link
Contributor

I'm using this to process inbound emails for tickets/replies, so useful to just get the reply part.
I added this lib to beyondcode/laravel-mailbox#7 to make it easier to process Inbound replies in Laravel.

What would make it easier to maintain perhaps, is making it possible to add custom signatures manually (eg $parser->addHeaderRegex($pattern)).

Are you still maintaining this, because it still looks like one of the best available packages in PHP.

@barryvdh
Copy link
Contributor

Oh my bad, there is actually getQuoteHeadersRegex() and gsetQuoteHeadersRegex() already :)

@barryvdh
Copy link
Contributor

And just as a FYI, I did some digging and most libraries support only English (like Github). The discourse reply trimmer is more extensive (and multi language) it seems: https://github.com/discourse/email_reply_trimmer
So perhaps for a future version, we could take a look at which regexes etc they use, or copy over the tests.

@willdurand
Copy link
Owner Author

Are you still maintaining this, because it still looks like one of the best available packages in PHP.

I am, at a very very low pace.

Thanks for using this lib!

@glensc
Copy link
Collaborator

glensc commented Mar 24, 2020

We use this in Eventum Issue Tracker to collapse quoted replies like GMail does:

@philippejadin
Copy link

I'm using it with great success for the open source groupware for collectives called Agorakit : https://github.com/agorakit/agorakit

And, really thank you for this tool, in short, the best option for php !

@voicecode-bv
Copy link

Still using this package, thank you so much for it. We're using it to allow users to send emails that will be added to a chatbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests