Plots2: Email auto replies are auto-posting to research notes.

Created on 5 Jun 2019  ·  20Comments  ·  Source: publiclab/plots2

This has happened before, but email auto replies are showing up as comment responses in threads on the site.

This particular email posted about 70 times, and contains information about the poster's personal schedule as well as contact information for another person.

AutoReplyPost

Can we disable auto comments in comment by email?

Ruby help wanted testing

All 20 comments

This is actually an issue on 2 posts-- the 2nd post is here: https://publiclab.org/notes/eustatic/05-24-2019/balloon-map-of-south-bonfouca-cel-usfws-planting-with-pies-and-toes

Worth noting that the email posting to the comments has a pretty clear "do not share" note at the bottom.
Screen Shot 2019-06-05 at 2 19 28 PM

Linking to previously opened issues at #3218 #4562 !

And just to update on the status here, the original fix at #3218 didn't work, or worked for only some autoreplies. I'm closing that in favor of this issue.

4562 was not followed up on, but I found some resources for how to identify an auto-reply email here: https://github.com/publiclab/plots2/issues/4562#issuecomment-458547740

https://stackoverflow.com/questions/1027395/detecting-outlook-autoreply-out-of-office-emails

https://stackoverflow.com/questions/9426801/detect-auto-reply-emails-programmatically

geerlingguy/Imap#6

https://github.com/jpmckinney/multi_mail/wiki/Detecting-autoresponders

And copying in the probably helpful notes from one of them:

There's no set of checks for auto-responses that produce perfect behavior (detect all auto-replies with no false positives), but the following checks have worked well so far:

header "Auto-Submitted" with value other than "no" (see RFC 3834)
headers "X-Autoreply" or "X-Autorespond" with any value
header "Precedence" with value "auto_reply"

Apparently we can read the headers like: email.headers["Message-ID"] -- so for the above:

  • email.headers["Auto-Submitted"] != "no"
  • email.headers["X-Autoreply"]
  • email.headers["X-Autorespond"]
  • email.headers["Precedence"] == "auto_reply"

This is going to be difficult to test out. We can do it manually. But we should try to collect several full autoreply emails from different sources and put them in our fixtures: https://github.com/publiclab/plots2/tree/master/test/fixtures/incoming_test_emails

@bronwen9 if you can fwd me some that would be very helpful

Tests should be easy to write against real captured email samples. I added Comment.is_autoreply(mail) which we can use.

OK, so our next steps would be:

  • [ ] to capture sample auto-reply emails from Gmail, Outlook, and Yahoo, and add them to our fixtures, as, for example: test/fixtures/incoming_test_emails/outlook/autoreply_incoming_outlook_email.eml
  • [ ] unit test with Comment.is_autoreply(Mail.read('test/fixtures/incoming_test_emails/outlook/autoreply_incoming_outlook_email.eml')) -- let's put this in https://github.com/publiclab/plots2/blob/master/test/unit/comment_test.rb !

Hey all, just letting folks know I am attempting to solve this issue so it's a work "in progress". Thanks!

thank you, much appreciated!!!

On Sun, Aug 4, 2019 at 12:51 AM enviro3 notifications@github.com wrote:

Hey all, just letting folks know I am attempting to solve this issue so
it's a work "in progress". Thanks!


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/5842?email_source=notifications&email_token=AAAF6J2XIDK3TID36KCEGKTQCXHRVA5CNFSM4HUCCSXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3PTZUY#issuecomment-517946579,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAF6J2XVSHP3PMP6ZOWJEDQCXHRVANCNFSM4HUCCSXA
.

Related: #6273

Here's how discourse forums handle it, and they'd be well-exercised:

https://github.com/discourse/discourse/blob/2ba4de2d45cd326820cf4616bdb60e047715e39f/lib/email/receiver.rb#L295-L301

Docs: https://meta.discourse.org/t/configuring-reply-via-email-e-mail/42026

  • auto_generated_email_error: happens when at least one of the following criteria is matched: ...

Since there is no standard to identify automatic emails we have to use regular expressions to match the most commonly used words and headers. [...]

Thanks, @patcon, this is really helpful. With some of these means of identifying auto-replies, we can develop some new features. However, also noting that @enviro3 in #6137 actually captured some real auto-replies to build our filters around, and began integrating them into a PR there.

That, combined with the observation from Discourse:

the precedence header is set to: list, junk, bulk or auto_reply
the email is from mailer-daemon, postmaster or noreply
any of the headers contain: auto-submitted, auto-replied, auto-reply or auto-generated (non exhaustive list).

should be something we can build the filter around. I'll see if I can help @enviro3 to rebase #6137 cleanly to build on. Thanks all!

OK, i worked a bit on this, and used @enviro3's collected samples of autoreplies from Outlook, Yahoo, and Gmail in addition to @patcon's collected properties to filter for, and wove them together into a Comment.is_autoreply() function.

expanded on @enviro3's tests to create tests to properly identify autoresponses and non-autoresponses; once those properly run, i have filtering code ready to test against the sample emails. Then we can use that filter when processing received emails.

6289 was just merged, potentially solving this. Just wanted to say thanks to:

  • @bronwen9 and @ebarry for clearly identifying and describing the issue, with examples
  • @enviro3 for carefully and thoroughly collecting sample emails and building tests around them
  • @patcon for finding the filter terms to look for

I hope this is resolved, but we'll have to wait and see -- it's a pretty complex little chunk of code. But all of these contributions were critical in solving this issue, so THANK YOU! 🙌 ❤️

And noting that, since the basic mechanism is built now, we can continue to add more sample emails from other email systems, and more precise mail filters, building on #6289 as we go.

Very cool!!!!!!!!
Thanks all

On Mon, Sep 16, 2019, 4:23 PM Jeffrey Warren notifications@github.com
wrote:

And noting that, since the basic mechanism is built now, we can continue
to add more sample emails from other email systems, and more precise mail
filters, building on #6289 https://github.com/publiclab/plots2/pull/6289
as we go.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/5842?email_source=notifications&email_token=AABHNHYDTXGPJVQ2PIQQWBTQJ7TMFA5CNFSM4HUCCSXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD62M3MY#issuecomment-531942835,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABHNH2ODN3XK7Z5Y6CZJNTQJ7TMFANCNFSM4HUCCSXA
.

6289 was just merged, potentially solving this. Just wanted to say thanks to:

  • @bronwen9 and @ebarry for clearly identifying and describing the issue, with examples
  • @enviro3 for carefully and thoroughly collecting sample emails and building tests around them
  • @patcon for finding the filter terms to look for

I hope this is resolved, but we'll have to wait and see -- it's a pretty complex little chunk of code. But all of these contributions were critical in solving this issue, so THANK YOU! 🙌 ❤️

Thank you @jywarren for wrapping this up! much appreciated

Was this page helpful?
0 / 5 - 0 ratings