Table of Contents |
---|
Body content from incoming emails can be selectively removed in order to alter the resulting issue description or comment. Regular expressions are used to match parts of the processed email body (note that when creating regular expressions it is best to work with post-processed content from a created/commented issue).
Removing specific parts of email content
To remove only particular parts of an email's content, you will most likely want to use a Cleanup Regexp. A clean up will only remove content that matches the regular expression.
Example 1
Code Block | ||||
---|---|---|---|---|
| ||||
MIME-Version: 1.0 Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT) Date: Sun, 19 Jun 2011 17:42:26 +1200 Message-ID: <BANLkTinB1mfSh+GwOXGNWoL4SyDvOpdBoQ@mail.gmail.com> Subject: This is a starting email template, update as required From: "Andy Brook" <andy@localhost> To: changeme@thiswontwork.com Content-Type: text/plain; charset=UTF-8 Hello, This text should stay. !!This text should be removed!! This should also stay. Regards, Sender |
Cleanup Regexp | Resulting body | ||||
---|---|---|---|---|---|
|
|
|
|
Example 2
Code Block | ||||
---|---|---|---|---|
| ||||
MIME-Version: 1.0 Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT) Date: Sun, 19 Jun 2011 17:42:26 +1200 Message-ID: <BANLkTinB1mfSh+GwOXGNWoL4SyDvOpdBoQ@mail.gmail.com> Subject: This is a starting email template, update as required From: "Andy Brook" <andy@localhost> To: changeme@thiswontwork.com Content-Type: text/plain; charset=UTF-8 Hello, This text should stay. !!Keep the exclamation marks!! This should also stay. Regards, Sender |
Cleanup Regexp | Resulting body | ||||
---|---|---|---|---|---|
|
|
|
|
|
Removing all content from a specific point onwards
To remove all content in an email starting from one point until the end of the content, you will want to use a Body Delimiter. A delimiter removes all content from its starting point. The starting point is where the delimiter regular expression first matches.
Email signatures and all trailing text can be removed through a Create/Comment Body Delimiter:
Code Block |
---|
MIME-Version: 1.0
Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT)
Date: Sun, 19 Jun 2011 17:42:26 +1200
Message-ID: <BANLkTinB1mfSh+GwOXGNWoL4SyDvOpdBoQ@mail.gmail.com>
Subject: This is a starting email template, update as required
From: "Andy Brook" <andy@test.com>
To: changeme@thiswontwork.com
Content-Type: text/plain; charset=UTF-8
some text
--
This is my sig |
With a Create/Comment Body Delimiter that matches the line above 'This is my sig', you can remove the signature from the final body:
Create/Comment Body Delimiter | Resulting body for create | Resulting body for comment | ||||||
---|---|---|---|---|---|---|---|---|
|
|
|
Removing old email content in replies
Things get interesting when replies to emails are handled, as there is no standard for the format of replies:
Code Block |
---|
MIME-Version: 1.0
Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT)
Date: Sun, 19 Jun 2011 17:42:26 +1200
Message-ID: <BANLkTinB1mfSh+GwOXGNWoL4SyDvOpdBoQ@mail.gmail.com>
Subject: This is a starting email template, update as required
From: "Andy Brook" <andy@test.com>
To: changeme@thiswontwork.com
Content-Type: text/plain; charset=UTF-8
this is the reply
On November 1 2014, at 14:31 Andy Brook <javahollic@gmail.com> wrote:
> blah
>
> -- |
The Comment Only Body Delimiter Regexps are used to match these lines (only when commenting on an issue) to identify the point at which the body should be truncated. Truncation on reply then results in just the required text being added:
Comment Only Body Delimiter | Resulting comment body | ||||
---|---|---|---|---|---|
|
|
Handling forwarded emails
When Dealing with forwarded email things get more complicated. During create, its less likely that you would would to apply signature stripping because the first match would cause content to be truncated there and then. During comment, its worse, because the content being forwarded looks like a reply, so would be stripped as part of the reply.
The setting Forwarded Email Subject Prefixes enables configuration of nominated email subject prefixes in a comma separated list.
Example Forwarded Email Subject Prefixes configuration |
---|
Fwd:,Fw:,WG:,Doorst: |
A forwarded message such as the one below will then be processed as follows:
Code Block |
---|
MIME-Version: 1.0
Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT)
Date: Sun, 19 Jun 2011 17:42:26 +1200
Message-ID: <BANLkTinB1mfSh+GwOXGNWoL4SyDvOpdBoQ@mail.gmail.com>
Subject: Fwd: This is a starting email template, update as required
From: "Andy Brook" <andy@test.com>
To: changeme@thiswontwork.com
Content-Type: text/plain; charset=UTF-8
this is a forwarded message
---------- Forwarded message ----------
From: Andy Brook <javahollic@gmail.com>
Date: 1 November 2014 14:31
Subject: hello world
To: Andy Brook <javahollic@gmail.com>
blah
--
This is my sig |
Create | Comment |
---|---|
Issue Description: |
|
Issue Comment: |
|
Related articles
Filter by label (Content by label) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
Page Properties | ||
---|---|---|
| ||
|