Email signature not being stripped out when user write new topic or reply to a topic

I was just able to send a message using a gmail address and using the web based gmail app - this had an image signature that was successfully trimmed

The same email account when sending a message using my local Outlook 2016 app on PC however did not get its signature stripped (same signature image, but set up in Outlook)

Realistically, the largest proportion of users of the forum will be using Microsoft Outlook app, so that would have to be a benchmark for ‘success’ of the trimming process.

Is it only one Outlook 2016 email source giving you trouble with signatures, or all of them?

Is Outlook 2016 known to insert stuff that is resistant to trimming? or was Outlook 2016 perhaps not deemed to be one of the popular apps that should be included in the email_reply_trimmer library?
Has anyone come up with a strategy for dealing with this? (other than asking users to remember to switch off automatic signatures whenever emailing the forum - which I know will elicit grumbles!)

I see also that while not trimmed, signatures in Outlook 2016 messages are not being parsed properly, in my case with messed up text formatting and fonts, as well as a couple of added text characters and an over scaled image - or is this the result of an unsuccessful trimming effort?

It’s one Outlook 16 user’s signature that always gets through the trimmer, and another with an unknown client (but sent through outlook.com and/or MS-Exchange) that has some white square image files at the bottom, like this:

![~WRD000.jpg|100x100](upload://bONwCMToQaefS5MCaw6ckHjvG5z.jpg)

![image001.jpg|45x45](upload://yS0BlfXTqaPhoqyF6LaZLwt7xJv.jpg)

There are other occasional signatures that get past the trimmer, but they don’t happen often or with any consistency.

1 Like

Hmm - what is best strategy from here?

Is this email_reply_trimmer library something that any idiot (such as myself) can mess around with to see if they can identify the patterns in the script as applied for other email apps and add a filter for Outlook 2016 signatures? I think I read this script is now part of core for Discourse? Or am I kidding myself?

I have never messed around with GitHub, and would not want to potentially mess anyone else up in the process of experimenting, or even inflict irreparable harm on my own forum.

You could send me a PM with the source of an email that doesn’t get trimmed properly. I’ll have a look.

3 Likes

We are using a web form to generate an email to create new topics in a Category.

The web form includes this by default:

This email was sent to [category email] as a result of a form being completed.
Click here to report unwanted email.

Is there a way to trim out a message like this?

Try changing the web form software to place the message below a -‍-  (two dashes and a space) to make it look more like a signature.

Blah blah
Form: Content

-- 

This email was sent to [category email] as a result of a form being completed.
Click here to report unwanted email.

don’t actually copy my two dashes and a space above, it has some unicode trickery in there

3 Likes

Thanks, I’ll see if that’s something we can add into the web form template!

This feature would be tremendously useful - being able to add offending signatures to a ‘strip this out if you see it again’ list. Matching could be a little more straightforward since it would just remove that text verbatim, rather than having to speculatively try to match all signatures.

5 Likes

I second this. Though I will try asking people to use "-- ".

1 Like

That isn’t quite right - it should have the space in the middle, so: “- -”

Personally, I have found it pretty difficult to get users to put that into their signatures. It is okay if you can look over their shoulder to set it up for them, but they struggle on their own!! Maybe yours are more tech savvy.

I’m pretty certain the convention is hyphen-hyphen-space, as set out above. See also the introductory comments and line 144 here: discourse_email_parser/lib/discourse_email_parser.rb at master · discourse/discourse_email_parser · GitHub

Those comments and code have “- -”. Take a closer look.

They really don’t. If you cut and paste the regex in line 144 into https://rubular.com/ you’ll see that it matches -- (hyphen-hyphen-space) but not - - (hyphen-space-hyphen).

3 Likes

Ah, I see. It sure looks as though there is a space in between, unless you cut and paste it into something else (from line 144):
"--/s" - looks like a space in between the hyphens to me when presented as code.
“–/s” cut and pasted into markdown directly, clearly no space.

This might explain why I’ve struggled to have any success with this! Thank you for holding the line.

3 Likes

You’re welcome :slight_smile:

I don’t know Ruby but \s seems to match a line return as well as a space - if that’s right then -- on its own line, without the space, should be OK too.

1 Like

Markdown uses a bunch of hyphens for a horizontal rule. We have messages that include meeting details below a horizontal rule. Is there an alternative that we can use to make a separator without causing trimming?

For example, an example incoming email might contain the following:


This is the content of an example email. It might contain meeting details. If this post were sent via email, then this part - and everything after it - would be trimmed.


Thanks!

I’ve just sent you a PM with an email and post that has been causing us trouble repeatedly.

The issue is that when they reply to a Discourse post via email a couple of white images seem to get appended to their post. This results in a chunk of unwanted white space after their text. It only seems to happen to this one user. They do not have an email signature per se.

2 Likes

I am still getting maybe 5-10% of member signatures slipping through.

If current heuristics can’t handle these, I really think a manual database for signatures or even embedded images in emails that keep being submitted and that don’t automatically get picked up is essential.

There is no way in the world that I can expect users to change their email signatures just for the forum, which represents only a tiny portion of their day to day email activity.

2 Likes

We certainly want to get better, we need examples of the failed detections so we can add to our test matrix.

3 Likes

How can we effectively submit failed examples so that you can improve things?

Personally, I cannot post examples directly here from our (private) forums due to it being a public space.

One possible way to do this would be a PM (perhaps tagged?) to a specific nominated staff member (with a link to set this up).

1 Like