Enabled signature detection for html emails.
This commit is contained in:
parent
a88e6b03b3
commit
ca141bbb9b
9 changed files with 768 additions and 51 deletions
|
@ -91,10 +91,14 @@ class ArticleViewItem extends App.ObserverController
|
|||
|
||||
# prepare html body
|
||||
if article.content_type is 'text/html'
|
||||
if article.sender.name is 'Agent'
|
||||
article['html'] = App.Utils.signatureIdentify(article.body, false, true)
|
||||
else
|
||||
article['html'] = App.Utils.signatureIdentify(article.body)
|
||||
body = article.body
|
||||
if article.preferences && article.preferences.signature_detection
|
||||
signatureDetected = '<span class="js-signatureMarker"></span>'
|
||||
body = body.replace(signatureDetected, '')
|
||||
body = body.split('<br>')
|
||||
body.splice(article.preferences.signature_detection, 0, signatureDetected)
|
||||
body = body.join('<br>')
|
||||
article['html'] = body
|
||||
else
|
||||
|
||||
# client signature detection
|
||||
|
@ -182,13 +186,16 @@ class ArticleViewItem extends App.ObserverController
|
|||
bubbleOvervlowContainer.css('opacity', '')
|
||||
|
||||
# remember offset of "see more"
|
||||
offsetTop = bubbleContent.find('.js-signatureMarker').position()
|
||||
signatureMarker = bubbleContent.find('.js-signatureMarker')
|
||||
if !signatureMarker.get(0)
|
||||
signatureMarker = bubbleContent.find('div [data-signature=true]')
|
||||
offsetTop = signatureMarker.position()
|
||||
|
||||
# safari - workaround
|
||||
# in safari somethimes the marker is directly on top via .top and inspector but it isn't
|
||||
# in this case use the next element
|
||||
if offsetTop && offsetTop.top is 0
|
||||
offsetTop = bubbleContent.find('.js-signatureMarker').next('div, p').position()
|
||||
offsetTop = signatureMarker.next('div, p, br').position()
|
||||
|
||||
# remember bubble heigth
|
||||
heigth = bubbleContent.height()
|
||||
|
|
|
@ -44,7 +44,7 @@ class Transaction::SignatureDetection
|
|||
type = Ticket::Article::Type.lookup(id: article.type_id)
|
||||
return if type['name'] != 'email'
|
||||
|
||||
# add queue job to update current signature of user id
|
||||
# update current signature of user id
|
||||
SignatureDetection.rebuild_user(article.created_by_id)
|
||||
|
||||
# user
|
||||
|
@ -52,7 +52,11 @@ class Transaction::SignatureDetection
|
|||
return if !user
|
||||
return if !user.preferences
|
||||
return if !user.preferences[:signature_detection]
|
||||
article.preferences[:signature_detection] = SignatureDetection.find_signature_line(user.preferences[:signature_detection], article.body)
|
||||
article.preferences[:signature_detection] = SignatureDetection.find_signature_line(
|
||||
user.preferences[:signature_detection],
|
||||
article.body,
|
||||
article.content_type,
|
||||
)
|
||||
article.save
|
||||
end
|
||||
|
||||
|
|
|
@ -287,13 +287,93 @@ class String
|
|||
|
||||
=end
|
||||
|
||||
def html2html_strict
|
||||
def html2html_strict(force = false)
|
||||
string = html2text(true, true)
|
||||
string.signature_identify(force)
|
||||
string = string.text2html
|
||||
string.gsub!(%r{######LINKEXT:(.+?)/TEXT:(.+?)######}, '<a href="\1" target="_blank">\2</a>')
|
||||
string.gsub!(/######LINKRAW:(.+?)######/, '<a href="\1" target="_blank">\1</a>')
|
||||
marker_template = '<span class="js-signatureMarker"></span>'
|
||||
string.sub!(/######SIGNATURE_MARKER######/, marker_template)
|
||||
string.gsub!(/######SIGNATURE_MARKER######/, '')
|
||||
string.gsub!(/######(.+?)######/, '<\1>')
|
||||
string.chomp
|
||||
end
|
||||
|
||||
def signature_identify(force = false)
|
||||
string = self
|
||||
|
||||
# if we do have less then 10 lines and less then 300 chars ignore this
|
||||
if !force
|
||||
lines = string.split("\n")
|
||||
return if lines.count < 10 && string.length < 300
|
||||
end
|
||||
|
||||
marker = '######SIGNATURE_MARKER######'
|
||||
|
||||
# search for signature seperator "--\n"
|
||||
string.sub!(/^\s{0,2}--\s{0,2}$/) { |placeholder|
|
||||
placeholder = "#{marker}#{placeholder}"
|
||||
}
|
||||
|
||||
map = {}
|
||||
# Apple Mail
|
||||
# On 01/04/15 10:55, Bob Smith wrote:
|
||||
map['apple-en'] = '^(On)[[:space:]].{6,20}[[:space:]].{3,10}[[:space:]].{1,250}[[:space:]](wrote):'
|
||||
|
||||
# Am 03.04.2015 um 20:58 schrieb Martin Edenhofer <me@znuny.ink>:
|
||||
map['apple-de'] = '^(Am)[[:space:]].{6,20}[[:space:]](um)[[:space:]].{3,10}[[:space:]](schrieb)[[:space:]].{1,250}:'
|
||||
|
||||
# Thunderbird
|
||||
# Am 04.03.2015 um 12:47 schrieb Alf Aardvark:
|
||||
map['thunderbird-de'] = '^(Am)[[:space:]].{6,20}[[:space:]](um)[[:space:]].{3,10}[[:space:]](schrieb)[[:space:]].{1,250}:'
|
||||
|
||||
# Thunderbird default - http://kb.mozillazine.org/Reply_header_settings
|
||||
# On 01-01-2007 11:00 AM, Alf Aardvark wrote:
|
||||
map['thunderbird-en-default'] = '^(On)[[:space:]].{6,20}[[:space:]].{3,10},[[:space:]].{1,250}(wrote):'
|
||||
|
||||
# http://kb.mozillazine.org/Reply_header_settings
|
||||
# Alf Aardvark wrote, on 01-01-2007 11:00 AM:
|
||||
map['thunderbird-en'] = '^.{1,250}[[:space:]](wrote),[[:space:]]on[[:space:]].{3,20}:'
|
||||
|
||||
# otrs
|
||||
# 25.02.2015 10:26 - edv hotline wrote:
|
||||
# 25.02.2015 10:26 - edv hotline schrieb:
|
||||
map['otrs-en-de'] = '^.{6,10}[[:space:]].{3,10}[[:space:]]-[[:space:]].{1,250}[[:space:]](wrote|schrieb):'
|
||||
|
||||
# Ms
|
||||
# rubocop:disable Style/AsciiComments
|
||||
# From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]
|
||||
# Send: Donnerstag, 2. April 2015 10:00
|
||||
# To/Cc/Bcc: xxx
|
||||
# Subject: xxx
|
||||
# - or -
|
||||
# From: xxx
|
||||
# To/Cc/Bcc: xxx
|
||||
# Date: 01.04.2015 12:41
|
||||
# Subject: xxx
|
||||
# - or -
|
||||
# De : xxx
|
||||
# À/?/?: xxx
|
||||
# Envoyé : mercredi 29 avril 2015 17:31
|
||||
# Objet : xxx
|
||||
# rubocop:enable Style/AsciiComments
|
||||
|
||||
# en/de/fr | sometimes ms adds a space to "xx : value"
|
||||
map['ms-en-de-fr_from'] = '^(From|Von|De)( ?):[[:space:]].+?'
|
||||
map['ms-en-de-fr_from_html'] = "\n######b######(From|Von|De)([[:space:]]?):([[:space:]]?)(######\/b######)[[:space:]].+?"
|
||||
|
||||
# word 14
|
||||
# edv hotline wrote:
|
||||
# edv hotline schrieb:
|
||||
#map['word-en-de'] = "[^#{marker}].{1,250}\s(wrote|schrieb):"
|
||||
|
||||
map.each {|_key, regexp|
|
||||
string.sub!(/#{regexp}/) { |placeholder|
|
||||
placeholder = "#{marker}#{placeholder}"
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,14 @@ module SignatureDetection
|
|||
|
||||
try to detect the signature in list of articles for example
|
||||
|
||||
signature = SignatureDetection.find_signature(string_list)
|
||||
messages = [
|
||||
{
|
||||
content: 'some content',
|
||||
content_type: 'text/plain',
|
||||
},
|
||||
]
|
||||
|
||||
signature = SignatureDetection.find_signature(messages)
|
||||
|
||||
returns
|
||||
|
||||
|
@ -12,13 +19,22 @@ returns
|
|||
|
||||
=end
|
||||
|
||||
def self.find_signature(string_list)
|
||||
def self.find_signature(messages)
|
||||
|
||||
string_list = []
|
||||
messages.each {|message|
|
||||
if message[:content_type] =~ %r{text/html}i
|
||||
string_list.push message[:content].html2text(true)
|
||||
next
|
||||
end
|
||||
string_list.push message[:content]
|
||||
}
|
||||
|
||||
# hash with possible signature and count of matches in string list
|
||||
possible_signatures = {}
|
||||
|
||||
# loop all strings in array
|
||||
( 0..string_list.length - 1 ).each {|main_string_index|
|
||||
string_list.each_with_index { |_main_string, main_string_index|
|
||||
break if main_string_index + 1 > string_list.length - 1
|
||||
|
||||
# loop all all strings in array except of the previous index
|
||||
|
@ -95,7 +111,7 @@ returns
|
|||
|
||||
this function will search for a signature string in a string (e.g. article) and return the line number of the signature start
|
||||
|
||||
signature_line = SignatureDetection.find_signature_line(signature, string)
|
||||
signature_line = SignatureDetection.find_signature_line(signature, message, content_type)
|
||||
|
||||
returns
|
||||
|
||||
|
@ -107,7 +123,11 @@ returns
|
|||
|
||||
=end
|
||||
|
||||
def self.find_signature_line(signature, string)
|
||||
def self.find_signature_line(signature, string, content_type)
|
||||
|
||||
if content_type =~ %r{text/html}i
|
||||
string = string.html2text(true)
|
||||
end
|
||||
|
||||
# try to find the char position of the signature
|
||||
search_position = string.index(signature)
|
||||
|
@ -133,12 +153,20 @@ returns
|
|||
def self.by_user_id(user_id)
|
||||
type = Ticket::Article::Type.lookup(name: 'email')
|
||||
sender = Ticket::Article::Sender.lookup(name: 'Customer')
|
||||
tickets = Ticket.where(
|
||||
created_by_id: user_id,
|
||||
create_article_type_id: type.id,
|
||||
create_article_sender_id: sender.id
|
||||
).limit(5).order(id: :desc)
|
||||
article_bodies = []
|
||||
tickets = Ticket.where(created_by_id: user_id, create_article_type_id: type.id, create_article_sender_id: sender.id).limit(5).order(id: :desc)
|
||||
tickets.each {|ticket|
|
||||
article = ticket.articles.first
|
||||
next if !article
|
||||
article_bodies.push article.body
|
||||
data = {
|
||||
content: article.body,
|
||||
content_type: article.content_type,
|
||||
}
|
||||
article_bodies.push data
|
||||
}
|
||||
|
||||
find_signature(article_bodies)
|
||||
|
@ -157,7 +185,6 @@ returns
|
|||
=end
|
||||
|
||||
def self.rebuild_all_user
|
||||
|
||||
User.select('id').where(active: true).order(id: :desc).each {|local_user|
|
||||
rebuild_user(local_user.id)
|
||||
}
|
||||
|
@ -209,7 +236,11 @@ returns
|
|||
user = User.find(article.created_by_id)
|
||||
next if !user.preferences[:signature_detection]
|
||||
|
||||
signature_line = find_signature_line(user.preferences[:signature_detection], article.body)
|
||||
signature_line = find_signature_line(
|
||||
user.preferences[:signature_detection],
|
||||
article.body,
|
||||
article.content_type,
|
||||
)
|
||||
next if !signature_line
|
||||
next if article.preferences[:signature_detection] == signature_line
|
||||
|
||||
|
|
155
test/fixtures/email_signature_detection/client_c_1.html
vendored
Normal file
155
test/fixtures/email_signature_detection/client_c_1.html
vendored
Normal file
|
@ -0,0 +1,155 @@
|
|||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
|
||||
<head>
|
||||
<!-- Template generated by Exclaimer Mail Disclaimers on 08:33:16 Dienstag, 28 Juni 2016 -->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<style type="text/css">P.ImprintUniqueID {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
LI.ImprintUniqueID {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
DIV.ImprintUniqueID {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
TABLE.ImprintUniqueIDTable {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
DIV.Section1 {
|
||||
page: Section1
|
||||
}
|
||||
</style>
|
||||
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
|
||||
<style><!--
|
||||
/* Font Definitions */
|
||||
@font-face
|
||||
{font-family:Helvetica;
|
||||
panose-1:2 11 6 4 2 2 2 2 2 4;}
|
||||
@font-face
|
||||
{font-family:"Cambria Math";
|
||||
panose-1:2 4 5 3 5 4 6 3 2 4;}
|
||||
@font-face
|
||||
{font-family:Calibri;
|
||||
panose-1:2 15 5 2 2 2 4 3 2 4;}
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman",serif;}
|
||||
a:link, span.MsoHyperlink
|
||||
{mso-style-priority:99;
|
||||
color:#0563C1;
|
||||
text-decoration:underline;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{mso-style-priority:99;
|
||||
color:#954F72;
|
||||
text-decoration:underline;}
|
||||
span.E-MailFormatvorlage17
|
||||
{mso-style-type:personal-reply;
|
||||
font-family:"Calibri",sans-serif;
|
||||
color:windowtext;}
|
||||
.MsoChpDefault
|
||||
{mso-style-type:export-only;
|
||||
font-size:10.0pt;}
|
||||
@page WordSection1
|
||||
{size:612.0pt 792.0pt;
|
||||
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
|
||||
div.WordSection1
|
||||
{page:WordSection1;}
|
||||
--></style><!--[if gte mso 9]><xml>
|
||||
<o:shapedefaults v:ext="edit" spidmax="1026" />
|
||||
</xml><![endif]--><!--[if gte mso 9]><xml>
|
||||
<o:shapelayout v:ext="edit">
|
||||
<o:idmap v:ext="edit" data="1" />
|
||||
</o:shapelayout></xml><![endif]-->
|
||||
</head>
|
||||
<body style="FONT-SIZE: x-small; FONT-FAMILY: Verdana; LINE-HEIGHT: normal; TEXT-INDENT: 0px" lang="DE" link="#0563C1" vlink="#954F72">
|
||||
<p class="ImprintUniqueID"></p>
|
||||
<p class="ImprintUniqueID"></p>
|
||||
<div class="WordSection1">
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">Guten Abend Herr Smith,<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">die Test-Instanz steht bereit. Sie ist ein Klon der Produktiv-Instanz.<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">FQDN: 999sv3902-Test.ad.org-unit.de<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">IPv4: 10.45.0.140<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">Die Anmeldedaten sind mit denen der Produktiv-Instanz identisch.<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">Alle POP3-Abrufe habe ich entfernt und das Senden von e-mails deaktiviert.<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
|
||||
<div></div>
|
||||
</div>
|
||||
<br>
|
||||
<p></p>
|
||||
<p class="ImprintUniqueID">
|
||||
<table class="ImprintUniqueIDTable" style="WIDTH: 100%; BORDER-COLLAPSE: collapse" cellspacing="0" cols="2" cellpadding="0" border="0">
|
||||
<tbody>
|
||||
<tr style="FONT-SIZE: 8pt">
|
||||
<td style="FONT-SIZE: 8pt; BORDER-TOP: #cecece 1px solid; FONT-FAMILY: Verdana; WIDTH: 315px; COLOR: #a0a0a0; PADDING-TOP: 10px" valign="top" width="240">
|
||||
<p class="ImprintUniqueID"><font style="FONT-SIZE: 8pt" color="#cecece" face="Verdana"></font><font style="FONT-SIZE: 8pt" color="#a1a1a1" face="Verdana">
|
||||
<table style="color: #A0A0A0; font-size: 8pt; font-family: Verdana;" cellpadding="0" cellspacing="0" class="12995e5b-0c66-4f65-91b1-046f9707942eTable">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><font style="font-size:11pt;color:#000000;"><font style="color:#000000;">Christian<font style="color:#000000;">
|
||||
</font>Smith</font></font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font style="color:#000000;"><font style="color:#000000;">Technik</font></font></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</font><font style="FONT-SIZE: 8pt" color="#a1a1a1" face="Verdana"></font></p>
|
||||
<p class="ImprintUniqueID"> </p>
|
||||
</td>
|
||||
<td style="BORDER-TOP: #cecece 1px solid; WIDTH: 695px; PADDING-BOTTOM: 10px; PADDING-TOP: 10px; PADDING-LEFT: 10px; BORDER-LEFT: #cecece 1px solid" valign="top">
|
||||
<table style="font-family:Verdana; color: #CECECE; font-size: 8pt;" cellpadding="0" cellspacing="0" class="12995e5b-0c66-4f65-91b1-046f9707942eTable">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Tel:</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;"><font style="font-family:Verdana;color:#000000;">+49 12 34 56 78 441</font></font></td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Fax:</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;"><font style="font-family:Verdana;color:#000000;">+49 12 34 56 78 499</font></font></td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td align="Left" width="25%" nowrap="1"><font style="font-family:Verdana;color:#000000;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Email:
|
||||
</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#000000;"><font style="font-family:Verdana;color:#000000;"><span style="font-family:Verdana;color:#000000;text-decoration:none;"><a href="mailto:Christian.Smith@example.com" title="Click to send email to Smith, Christian" target="" style="font-family:Verdana;color:#000000;text-decoration:none;"><span style="font-family:Verdana; color:#000000; text-decoration:none;">Christian.Smith@example.com</span></a></span></font></font></td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Web:</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#000000;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">www.example.com</font></font></font></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="BORDER-BOTTOM: #cecece 1px solid"><font style="FONT-SIZE: 7pt; FONT-FAMILY: Verdana; COLOR: #a0a0a0" color="#cecece" face="Verdana">ABC KFZ- und Flugzeug B.V. & Co. KG<br>
|
||||
Hauptverwaltung<br>
|
||||
Ost Straße 2<br>
|
||||
12345 Somewhere</font></td>
|
||||
<td style="BORDER-BOTTOM: #cecece 1px solid; PADDING-BOTTOM: 10px; PADDING-LEFT: 10px; BORDER-LEFT: #cecece 1px solid" valign="top">
|
||||
<font style="FONT-SIZE: 7pt; FONT-FAMILY: Verdana; COLOR: #a0a0a0" color="#cecece" face="Verdana"></font></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
<font color="#000000"><!-- This is the environment stuff -->
|
||||
<p class="ImprintUniqueID" style="FONT-SIZE: 7pt">
|
||||
<table class="ImprintUniqueIDTable" style="WIDTH: 100%; BORDER-COLLAPSE: collapse" cellspacing="0" cols="2" cellpadding="0" border="0">
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
<!-- This is the start of the disclaimer -->
|
||||
<p class="ImprintUniqueID" style="FONT-SIZE: 7pt"><font color="#cfcfcf" face="Verdana"><font title="Disclaimer HVW" face="Verdana"><br>
|
||||
<font size="1">ABC KFZ- und Flugzeug B.V. & Co. KG<br>
|
||||
</font></font><font size="1">Sitz: Zuhause, HARA 123 Stern/Tief<br>
|
||||
phG: ABC Beteiligungs B.V.<br>
|
||||
Wo: Dorten, Kammer van What 1234567<br>
|
||||
Auch noch: Zuhause, HRB ABC Stern/Tief<br>
|
||||
Geschäftsführer: André Bob / Gery Hauer<br>
|
||||
<br>
|
||||
</font></font></p>
|
||||
</body>
|
||||
</html>
|
182
test/fixtures/email_signature_detection/client_c_2.html
vendored
Normal file
182
test/fixtures/email_signature_detection/client_c_2.html
vendored
Normal file
|
@ -0,0 +1,182 @@
|
|||
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
|
||||
<head>
|
||||
<!-- Template generated by Exclaimer Mail Disclaimers on 03:13:32 Dienstag, 14 Juni 2016 -->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<style type="text/css">P.ImprintUniqueID {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
LI.ImprintUniqueID {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
DIV.ImprintUniqueID {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
TABLE.ImprintUniqueIDTable {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
DIV.Section1 {
|
||||
page: Section1
|
||||
}
|
||||
</style>
|
||||
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
|
||||
<style><!--
|
||||
/* Font Definitions */
|
||||
@font-face
|
||||
{font-family:Helvetica;
|
||||
panose-1:2 11 6 4 2 2 2 2 2 4;}
|
||||
@font-face
|
||||
{font-family:"Cambria Math";
|
||||
panose-1:2 4 5 3 5 4 6 3 2 4;}
|
||||
@font-face
|
||||
{font-family:Calibri;
|
||||
panose-1:2 15 5 2 2 2 4 3 2 4;}
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman",serif;}
|
||||
a:link, span.MsoHyperlink
|
||||
{mso-style-priority:99;
|
||||
color:#0563C1;
|
||||
text-decoration:underline;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{mso-style-priority:99;
|
||||
color:#954F72;
|
||||
text-decoration:underline;}
|
||||
span.E-MailFormatvorlage17
|
||||
{mso-style-type:personal;
|
||||
font-family:"Calibri",sans-serif;
|
||||
color:black;}
|
||||
span.E-MailFormatvorlage18
|
||||
{mso-style-type:personal-compose;
|
||||
font-family:"Calibri",sans-serif;
|
||||
color:windowtext;}
|
||||
.MsoChpDefault
|
||||
{mso-style-type:export-only;
|
||||
font-size:10.0pt;}
|
||||
@page WordSection1
|
||||
{size:612.0pt 792.0pt;
|
||||
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
|
||||
div.WordSection1
|
||||
{page:WordSection1;}
|
||||
--></style><!--[if gte mso 9]><xml>
|
||||
<o:shapedefaults v:ext="edit" spidmax="1026" />
|
||||
</xml><![endif]--><!--[if gte mso 9]><xml>
|
||||
<o:shapelayout v:ext="edit">
|
||||
<o:idmap v:ext="edit" data="1" />
|
||||
</o:shapelayout></xml><![endif]-->
|
||||
</head>
|
||||
<body style="FONT-SIZE: x-small; FONT-FAMILY: Verdana; LINE-HEIGHT: normal; TEXT-INDENT: 0px" lang="DE" link="#0563C1" vlink="#954F72">
|
||||
<p class="ImprintUniqueID"></p>
|
||||
<p class="ImprintUniqueID"></p>
|
||||
<div class="WordSection1">
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">Guten Tag Herr Smith,<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">die folgenden Gruppen wurden erstellt und die Benutzer entsprechend der Anfrage als Mitlgieder hinzugeügt.<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><b><u><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">org.local:<o:p></o:p></span></u></b></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">DistinguishedName<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">-----------------<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-Leiter-ABCD---Debitor,OU=ABC,OU=X,DC=org,DC=local<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-Leiter-ABCD---Hauptbuch,OU=ABC,OU=X,DC=org,DC=local<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-Leiter-ABCD---Kreditor,OU=ABC,OU=X,DC=org,DC=local<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-MA-ABCD---Stammdaten,OU=ABC,OU=X,DC=org,DC=local<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
|
||||
<p class="MsoNormal"><b><u><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">ad.org-unit.de:<o:p></o:p></span></u></b></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">DistinguishedName<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">-----------------<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-Leiter-ABCD---Debitor,OU=Z,OU=Gruppen,OU=Service,DC=ad,DC=org-unit,DC=de<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-Leiter-ABCD---Hauptbuch,OU=Z,OU=Gruppen,OU=Service,DC=ad,DC=org-unit,DC=de<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-Leiter-ABCD---Kreditor,OU=Z,OU=Gruppen,OU=Service,DC=ad,DC=org-unit,DC=de<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-MA-ABCD---Stammdaten,OU=Z,OU=Gruppen,OU=Service,DC=ad,DC=org-unit,DC=de<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
|
||||
<p class="MsoNormal"><b><u><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">example.local:<o:p></o:p></span></u></b></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">DistinguishedName<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">-----------------<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-Leiter-ABCD---Debitor,OU=ABC,OU=Admin-Gruppen,OU=Service-Bereich,DC=example,DC=local<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-Leiter-ABCD---Hauptbuch,OU=ABC,OU=Admin-Gruppen,OU=Service-Bereich,DC=example,DC=local<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-Leiter-ABCD---Kreditor,OU=ABC,OU=Admin-Gruppen,OU=Service-Bereich,DC=example,DC=local<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US">CN=sec-xyz-R-MA-ABCD---Stammdaten,OU=ABC,OU=Admin-Gruppen,OU=Service-Bereich,DC=example,DC=local<o:p></o:p></span></p>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
|
||||
<div>
|
||||
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Mit freundlichen Grüßen<o:p></o:p></span></p>
|
||||
</div>
|
||||
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
|
||||
<div></div>
|
||||
</div>
|
||||
<br>
|
||||
<p></p>
|
||||
<p class="ImprintUniqueID">
|
||||
<table class="ImprintUniqueIDTable" style="WIDTH: 100%; BORDER-COLLAPSE: collapse" cellspacing="0" cols="2" cellpadding="0" border="0">
|
||||
<tbody>
|
||||
<tr style="FONT-SIZE: 8pt">
|
||||
<td style="FONT-SIZE: 8pt; BORDER-TOP: #cecece 1px solid; FONT-FAMILY: Verdana; WIDTH: 315px; COLOR: #a0a0a0; PADDING-TOP: 10px" valign="top" width="240">
|
||||
<p class="ImprintUniqueID"><font style="FONT-SIZE: 8pt" color="#cecece" face="Verdana"></font><font style="FONT-SIZE: 8pt" color="#a1a1a1" face="Verdana">
|
||||
<table style="color: #A0A0A0; font-size: 8pt; font-family: Verdana;" cellpadding="0" cellspacing="0" class="e5b45324-5a70-4aec-b580-3a0a8455ebf9Table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><font style="font-size:11pt;color:#000000;"><font style="color:#000000;">Christian<font style="color:#000000;">
|
||||
</font>Smith</font></font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font style="color:#000000;"><font style="color:#000000;">Technik</font></font></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</font><font style="FONT-SIZE: 8pt" color="#a1a1a1" face="Verdana"></font></p>
|
||||
<p class="ImprintUniqueID"> </p>
|
||||
</td>
|
||||
<td style="BORDER-TOP: #cecece 1px solid; WIDTH: 695px; PADDING-BOTTOM: 10px; PADDING-TOP: 10px; PADDING-LEFT: 10px; BORDER-LEFT: #cecece 1px solid" valign="top">
|
||||
<table style="font-family:Verdana; color: #CECECE; font-size: 8pt;" cellpadding="0" cellspacing="0" class="e5b45324-5a70-4aec-b580-3a0a8455ebf9Table">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Tel:</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;"><font style="font-family:Verdana;color:#000000;">+49 12 34 56 78 441</font></font></td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Fax:</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;"><font style="font-family:Verdana;color:#000000;">+49 12 34 56 78 499</font></font></td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td align="Left" width="25%" nowrap="1"><font style="font-family:Verdana;color:#000000;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Email:
|
||||
</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#000000;"><font style="font-family:Verdana;color:#000000;"><span style="font-family:Verdana;color:#000000;text-decoration:none;"><a href="mailto:Christian.Smith@example.com" title="Click to send email to Smith, Christian" target="" style="font-family:Verdana;color:#000000;text-decoration:none;"><span style="font-family:Verdana; color:#000000; text-decoration:none;">Christian.Smith@example.com</span></a></span></font></font></td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Web:</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#000000;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">www.example.com</font></font></font></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="BORDER-BOTTOM: #cecece 1px solid"><font style="FONT-SIZE: 7pt; FONT-FAMILY: Verdana; COLOR: #a0a0a0" color="#cecece" face="Verdana">ABC KFZ- und Flugzeug B.V. & Co. KG<br>
|
||||
Hauptverwaltung<br>
|
||||
Ost Straße 2<br>
|
||||
12345 Somewhere</font></td>
|
||||
<td style="BORDER-BOTTOM: #cecece 1px solid; PADDING-BOTTOM: 10px; PADDING-LEFT: 10px; BORDER-LEFT: #cecece 1px solid" valign="top">
|
||||
<font style="FONT-SIZE: 7pt; FONT-FAMILY: Verdana; COLOR: #a0a0a0" color="#cecece" face="Verdana"></font></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
<font color="#000000"><!-- This is the environment stuff -->
|
||||
<p class="ImprintUniqueID" style="FONT-SIZE: 7pt">
|
||||
<table class="ImprintUniqueIDTable" style="WIDTH: 100%; BORDER-COLLAPSE: collapse" cellspacing="0" cols="2" cellpadding="0" border="0">
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
<!-- This is the start of the disclaimer -->
|
||||
<p class="ImprintUniqueID" style="FONT-SIZE: 7pt"><font color="#cfcfcf" face="Verdana"><font title="Disclaimer HVW" face="Verdana"><br>
|
||||
<font size="1">ABC KFZ- und Flugzeug B.V. & Co. KG<br>
|
||||
</font></font><font size="1">Sitz: Zuhause, HARA 123 Stern/Tief<br>
|
||||
phG: ABC Beteiligungs B.V.<br>
|
||||
Wo: Dorten, Kammer van What 1234567<br>
|
||||
Auch noch: Zuhause, HRB ABC Stern/Tief<br>
|
||||
Geschäftsführer: André Bob / Gery Hauer<br>
|
||||
<br>
|
||||
</font></font></p>
|
||||
</body>
|
||||
</html>
|
167
test/fixtures/email_signature_detection/client_c_3.html
vendored
Normal file
167
test/fixtures/email_signature_detection/client_c_3.html
vendored
Normal file
|
@ -0,0 +1,167 @@
|
|||
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
|
||||
<head>
|
||||
<!-- Template generated by Exclaimer Mail Disclaimers on 10:23:35 Freitag, 6 Mai 2016 -->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<style type="text/css">P.ImprintUniqueID {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
LI.ImprintUniqueID {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
DIV.ImprintUniqueID {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
TABLE.ImprintUniqueIDTable {
|
||||
MARGIN: 0cm 0cm 0pt
|
||||
}
|
||||
DIV.Section1 {
|
||||
page: Section1
|
||||
}
|
||||
</style>
|
||||
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
|
||||
<style><!--
|
||||
/* Font Definitions */
|
||||
@font-face
|
||||
{font-family:"Cambria Math";
|
||||
panose-1:2 4 5 3 5 4 6 3 2 4;}
|
||||
@font-face
|
||||
{font-family:Calibri;
|
||||
panose-1:2 15 5 2 2 2 4 3 2 4;}
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
font-size:11.0pt;
|
||||
font-family:"Calibri",sans-serif;
|
||||
mso-fareast-language:EN-US;}
|
||||
a:link, span.MsoHyperlink
|
||||
{mso-style-priority:99;
|
||||
color:#0563C1;
|
||||
text-decoration:underline;}
|
||||
a:visited, span.MsoHyperlinkFollowed
|
||||
{mso-style-priority:99;
|
||||
color:#954F72;
|
||||
text-decoration:underline;}
|
||||
span.E-MailFormatvorlage17
|
||||
{mso-style-type:personal-compose;
|
||||
font-family:"Times New Roman",serif;}
|
||||
.MsoChpDefault
|
||||
{mso-style-type:export-only;
|
||||
font-family:"Calibri",sans-serif;
|
||||
mso-fareast-language:EN-US;}
|
||||
@page WordSection1
|
||||
{size:612.0pt 792.0pt;
|
||||
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
|
||||
div.WordSection1
|
||||
{page:WordSection1;}
|
||||
--></style>
|
||||
</head>
|
||||
<body style="FONT-SIZE: x-small; FONT-FAMILY: Verdana; LINE-HEIGHT: normal; TEXT-INDENT: 0px" lang="DE" link="#0563C1" vlink="#954F72">
|
||||
<p class="ImprintUniqueID"></p>
|
||||
<p class="ImprintUniqueID"></p>
|
||||
<div class="WordSection1">
|
||||
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Times New Roman",serif"><br>
|
||||
<br>
|
||||
<br>
|
||||
Sehr geehrte Damen und Herren,<br>
|
||||
<br>
|
||||
ich bin z.Zt. nicht per E-Mail erreichbar.<br>
|
||||
In dringenden Fällen wenden Sie sich bitte an it-support@example.de<br>
|
||||
Ihre E-Mail wird nicht weitergeleitet.<o:p></o:p></span></p>
|
||||
</div>
|
||||
<br>
|
||||
<p></p>
|
||||
<p class="ImprintUniqueID">
|
||||
<table class="ImprintUniqueIDTable" style="WIDTH: 100%; BORDER-COLLAPSE: collapse" cellspacing="0" cols="2" cellpadding="0" border="0">
|
||||
<tbody>
|
||||
<tr style="FONT-SIZE: 8pt">
|
||||
<td style="FONT-SIZE: 8pt; BORDER-TOP: #cecece 1px solid; FONT-FAMILY: Verdana; WIDTH: 315px; COLOR: #a0a0a0; PADDING-TOP: 10px" valign="top" width="240">
|
||||
<p class="ImprintUniqueID"><font style="FONT-SIZE: 8pt" color="#cecece" face="Verdana"></font><font style="FONT-SIZE: 8pt" color="#a1a1a1" face="Verdana">
|
||||
<table style="color: #A0A0A0; font-size: 8pt; font-family: Verdana;" cellpadding="0" cellspacing="0" class="325975d5-3d55-4a8c-a73d-e7606092ca3fTable">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><font style="font-size:11pt;color:#000000;"><font style="color:#000000;">Christian<font style="color:#000000;">
|
||||
</font>Smith</font></font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font style="color:#000000;"><font style="color:#000000;">Technik</font></font></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</font><font style="FONT-SIZE: 8pt" color="#a1a1a1" face="Verdana"></font></p>
|
||||
<p class="ImprintUniqueID"> </p>
|
||||
</td>
|
||||
<td style="BORDER-TOP: #cecece 1px solid; WIDTH: 695px; PADDING-BOTTOM: 10px; PADDING-TOP: 10px; PADDING-LEFT: 10px; BORDER-LEFT: #cecece 1px solid" valign="top">
|
||||
<table style="font-family:Verdana; color: #CECECE; font-size: 8pt;" cellpadding="0" cellspacing="0" class="325975d5-3d55-4a8c-a73d-e7606092ca3fTable">
|
||||
<tbody>
|
||||
<tr style="">
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Tel:</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;"><font style="font-family:Verdana;color:#000000;">+49 12 34 56 78 441</font></font></td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Fax:</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;"><font style="font-family:Verdana;color:#000000;">+49 12 34 56 78 499</font></font></td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td align="Left" width="25%" nowrap="1"><font style="font-family:Verdana;color:#000000;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Email:
|
||||
</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#000000;"><font style="font-family:Verdana;color:#000000;"><span style="font-family:Verdana;color:#000000;text-decoration:none;"><a href="mailto:Christian.Smith@example.com" title="Click to send email to Smith, Christian" target="" style="font-family:Verdana;color:#000000;text-decoration:none;"><span style="font-family:Verdana; color:#000000; text-decoration:none;">Christian.Smith@example.com</span></a></span></font></font></td>
|
||||
</tr>
|
||||
<tr style="">
|
||||
<td align="Left"><font style="font-family:Verdana;color:#A0A0A0;font-weight:bold;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">Web:</font></font></font></td>
|
||||
<td align="Left"><font style="font-family:Verdana;color:#000000;"><font style="font-family:Verdana;color:#000000;"><font style="font-family:verdana;color:#000000;font-weight:normal;">www.example.com</font></font></font></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="BORDER-BOTTOM: #cecece 1px solid"><font style="FONT-SIZE: 7pt; FONT-FAMILY: Verdana; COLOR: #a0a0a0" color="#cecece" face="Verdana">ABC KFZ- und Flugzeug B.V. & Co. KG<br>
|
||||
Hauptverwaltung<br>
|
||||
Ost Straße 2<br>
|
||||
12345 Somewhere<br>
|
||||
Tel.: +001 1234 0000 0<br>
|
||||
Fax: +001 1234 0000 99</font></td>
|
||||
<td style="BORDER-BOTTOM: #cecece 1px solid; PADDING-BOTTOM: 10px; PADDING-LEFT: 10px; BORDER-LEFT: #cecece 1px solid" valign="top">
|
||||
<font style="FONT-SIZE: 7pt; FONT-FAMILY: Verdana; COLOR: #a0a0a0" color="#cecece" face="Verdana"></font></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
<font color="#000000"><!-- This is the environment stuff -->
|
||||
<p class="ImprintUniqueID" style="FONT-SIZE: 7pt">
|
||||
<table class="ImprintUniqueIDTable" style="WIDTH: 100%; BORDER-COLLAPSE: collapse" cellspacing="0" cols="2" cellpadding="0" border="0">
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
<!-- This is the start of the disclaimer -->
|
||||
<p class="ImprintUniqueID" style="FONT-SIZE: 7pt"><font color="#cfcfcf" face="Verdana"><font title="Disclaimer HVW" face="Verdana"><br>
|
||||
<font size="1">ABC KFZ- und Flugzeug B.V. & Co. KG<br>
|
||||
</font></font><font size="1">Sitz: Zuhause, HARA 123 Stern/Tief<br>
|
||||
phG: ABC Beteiligungs B.V.<br>
|
||||
Wo: Dorten, Kammer van What 1234567<br>
|
||||
Auch noch: Zuhause, HRB ABC Stern/Tief<br>
|
||||
Geschäftsführer: André Bob / Gery Hauer<br>
|
||||
<br>
|
||||
</font></font></p>
|
||||
<p class="ImprintUniqueID" style="FONT-SIZE: 7pt"><br>
|
||||
<br>
|
||||
</p>
|
||||
</font>
|
||||
<p></p>
|
||||
<p class="ImprintUniqueID"><font face="Verdana"></font></p>
|
||||
<p></p>
|
||||
<p class="ImprintUniqueID"></p>
|
||||
<p class="ImprintUniqueID"></p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
|
@ -574,4 +574,86 @@ Men-----------------------'
|
|||
|
||||
end
|
||||
|
||||
test 'signature_identify function' do
|
||||
marker_template = '######SIGNATURE_MARKER######'
|
||||
|
||||
source = 'test'
|
||||
result = 'test'
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
source = "test\n--\nend"
|
||||
result = "test\n#{marker_template}--\nend"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
source = "On 01/04/15 10:55, Bob Smith wrote:"
|
||||
result = "#{marker_template}On 01/04/15 10:55, Bob Smith wrote:"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
source = "Am 03.04.2015 um 20:58 schrieb Martin Edenhofer <me@znuny.ink>:"
|
||||
result = "#{marker_template}Am 03.04.2015 um 20:58 schrieb Martin Edenhofer <me@znuny.ink>:"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
source = "\ntest 123 \n1\n2\n3\n4\n5\n6\n7\n8\n9\n--\nBob Smith\n"
|
||||
result = "\ntest 123 \n1\n2\n3\n4\n5\n6\n7\n8\n9\n#{marker_template}--\nBob Smith\n"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
source = "test 123 \n--no not match--\n--\nBob Smith\n"
|
||||
result = "test 123 \n--no not match--\n#{marker_template}--\nBob Smith\n"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
source = "test 123 \n--no not match--\n -- \nBob Smith\n"
|
||||
result = "test 123 \n--no not match--\n#{marker_template} -- \nBob Smith\n"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
source = "test 123 \n\n--\nBob Smith\n\n\n\n\n--\nBob Smith\n"
|
||||
result = "test 123 \n#{marker_template}\n--\nBob Smith\n\n\n\n\n--\nBob Smith\n"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
source = "test 123\ntest 123\n--\nBob Smith\n"
|
||||
result = "test 123\ntest 123\n#{marker_template}--\nBob Smith\n"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
source = "test 123\ntest 123\n--\nBob Smith\n\n"
|
||||
result = "test 123\ntest 123\n#{marker_template}--\nBob Smith\n\n"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
# apple
|
||||
# en
|
||||
source = "test 123 \n--no not match--\nBob Smith\nOn 01/04/15 10:55, Bob Smith wrote:\nlalala\n--\nsome test"
|
||||
result = "test 123 \n--no not match--\nBob Smith\n#{marker_template}On 01/04/15 10:55, Bob Smith wrote:\nlalala\n#{marker_template}--\nsome test"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
# de
|
||||
source = "test 123 \n\n--no not match--\n\nBob Smith\nAm 03.04.2015 um 20:58 schrieb Bob Smith <bob@example.com>:\nlalala"
|
||||
result = "test 123 \n\n--no not match--\n\nBob Smith\n#{marker_template}Am 03.04.2015 um 20:58 schrieb Bob Smith <bob@example.com>:\nlalala"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
# ms
|
||||
# en
|
||||
source = "test 123 \n\n--no not match--\n\nBob Smith\nFrom: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nSent: Donnerstag, 2. April 2015 10:00\nlalala</div>"
|
||||
result = "test 123 \n\n--no not match--\n\nBob Smith\n#{marker_template}From: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nSent: Donnerstag, 2. April 2015 10:00\nlalala</div>"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
# de
|
||||
source = "test 123 \n\n--no not match--\n\nBob Smith\nVon: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nGesendet: Donnerstag, 2. April 2015 10:00\nBetreff: lalala\n"
|
||||
result = "test 123 \n\n--no not match--\n\nBob Smith\n#{marker_template}Von: Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nGesendet: Donnerstag, 2. April 2015 10:00\nBetreff: lalala\n"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
# fr
|
||||
source = "\ntest 123 \n\n--no not match--\n\nBob Smith\nDe : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nEnvoyé : mercredi 29 avril 2015 17:31\nObjet : lalala\n"
|
||||
result = "\ntest 123 \n\n--no not match--\n\nBob Smith\n#{marker_template}De : Martin Edenhofer via Znuny Support [mailto:support@znuny.inc]\nEnvoyé : mercredi 29 avril 2015 17:31\nObjet : lalala\n"
|
||||
assert_equal(result, source.signature_identify(true))
|
||||
|
||||
|
||||
marker_template = '<span class="js-signatureMarker"></span>'
|
||||
html = "<br>lalala<br>--<br>Max Mix"
|
||||
result = "lalala<br>#{marker_template}--<br>Max Mix"
|
||||
assert_equal(result, html.html2html_strict(true))
|
||||
|
||||
html = "den.<br><br><b>Von:</b> Fritz Bauer [mailto:me@example.com]<br><b>Gesendet:</b> Donnerstag, 3. Mai 2012 11:51<br><b>An:</b> John Smith<br><b>Cc:</b> Smith, John Marian; johnel.fratczak@example.com; ole.brei@example.com; Günther John | Example GmbH; bkopon@example.com; john.heisterhagen@team.example.com; sven.rocked@example.com; michael.house@example.com; tgutzeit@example.com<br><b>Betreff:</b> Re: OTRS::XXX Erweiterung - Anhänge an CI's<br><br>Hallo,<br><br>ich versuche an den Punkten"
|
||||
result = "den.<br>#{marker_template}<br><b>Von:</b> Fritz Bauer [mailto:me@example.com]<br><b>Gesendet:</b> Donnerstag, 3. Mai 2012 11:51<br><b>An:</b> John Smith<br><b>Cc:</b> Smith, John Marian; johnel.fratczak@example.com; ole.brei@example.com; Günther John | Example GmbH; bkopon@example.com; john.heisterhagen@team.example.com; sven.rocked@example.com; michael.house@example.com; tgutzeit@example.com<br><b>Betreff:</b> Re: OTRS::XXX Erweiterung - Anhänge an CI's<br><br>Hallo,<br><br>ich versuche an den Punkten"
|
||||
assert_equal(result, html.html2html_strict(true))
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -7,60 +7,69 @@ class EmailSignaturDetectionTest < ActiveSupport::TestCase
|
|||
|
||||
# fixtures of sender a
|
||||
fixture_files = {
|
||||
'email_signature_detection/client_a_1.txt' => { line: 10 },
|
||||
'email_signature_detection/client_a_2.txt' => { line: 20 },
|
||||
'email_signature_detection/client_a_3.txt' => { line: 6 },
|
||||
'email_signature_detection/client_a_1.txt' => { line: 10, content_type: 'text/plain' },
|
||||
'email_signature_detection/client_a_2.txt' => { line: 20, content_type: 'text/plain' },
|
||||
'email_signature_detection/client_a_3.txt' => { line: 6, content_type: 'text/plain' },
|
||||
}
|
||||
|
||||
fixture_files_string_list = []
|
||||
|
||||
fixture_files.keys.each do |filepath|
|
||||
|
||||
file = File.new("#{Rails.root}/test/fixtures/#{filepath}", 'r')
|
||||
|
||||
file_content = file.read
|
||||
fixture_files[filepath][:content] = file_content
|
||||
fixture_files_string_list.push(file_content)
|
||||
fixture_messages = []
|
||||
fixture_files.each do |filepath, value|
|
||||
value[:content] = File.new("#{Rails.root}/test/fixtures/#{filepath}", 'r').read
|
||||
fixture_messages.push value
|
||||
end
|
||||
|
||||
signature = SignatureDetection.find_signature(fixture_files_string_list)
|
||||
signature = SignatureDetection.find_signature(fixture_messages)
|
||||
expected_signature = "\nMit freundlichen Grüßen\n\nBob Smith\nBerechtigungen und dez. Department\n________________________________\n\nMusik AG\nBerechtigungen und dez. Department (ITPBM)\nKastanien 2\n12345 Hornhausen\nTel.: +49 911 6760\nFax: +49 911 85 6760\nMobil: +49 173 911\nE-Mail: Bob.Smith@music.com\nhttp://www.music.com\n\nMusik AG | Kastanien 2 | 12345 Hornhausen\nSitz der AG: Hornhausen, HRB xxxxx | USt.-ID: DE 111222333444\nVorstand: Marc Smith, Weber Huber\nAufsichtsrat: Max Mix (Vors.)"
|
||||
assert_equal(expected_signature, signature)
|
||||
|
||||
fixture_files.keys.each do |filepath|
|
||||
expected_signature_position = fixture_files[filepath][:line]
|
||||
|
||||
assert_equal(expected_signature_position, SignatureDetection.find_signature_line(signature, fixture_files[filepath][:content]))
|
||||
fixture_files.each do |_filepath, value|
|
||||
assert_equal(value[:line], SignatureDetection.find_signature_line(signature, value[:content], value[:content_type]))
|
||||
end
|
||||
end
|
||||
|
||||
test 'test case II - sender b' do
|
||||
|
||||
fixture_files = {
|
||||
'email_signature_detection/client_b_1.txt' => { line: 26 },
|
||||
'email_signature_detection/client_b_2.txt' => { line: 4 },
|
||||
'email_signature_detection/client_b_3.txt' => { line: 6 },
|
||||
'email_signature_detection/client_b_1.txt' => { line: 26, content_type: 'text/plain' },
|
||||
'email_signature_detection/client_b_2.txt' => { line: 4, content_type: 'text/plain' },
|
||||
'email_signature_detection/client_b_3.txt' => { line: 6, content_type: 'text/plain' },
|
||||
}
|
||||
|
||||
fixture_files_string_list = []
|
||||
|
||||
fixture_files.keys.each do |filepath|
|
||||
|
||||
file = File.new("#{Rails.root}/test/fixtures/#{filepath}", 'r')
|
||||
|
||||
file_content = file.read
|
||||
fixture_files[filepath][:content] = file_content
|
||||
fixture_files_string_list.push(file_content)
|
||||
fixture_messages = []
|
||||
fixture_files.each do |filepath, value|
|
||||
value[:content] = File.new("#{Rails.root}/test/fixtures/#{filepath}", 'r').read
|
||||
fixture_messages.push value
|
||||
end
|
||||
|
||||
signature = SignatureDetection.find_signature(fixture_files_string_list)
|
||||
signature = SignatureDetection.find_signature(fixture_messages)
|
||||
expected_signature = "\nFreundliche Grüße\n\nGünter Lässig\nLokale Daten\n\nMusic GmbH\nBaustraße 123, 12345 Max City\nTelefon 0123 5432114\nTelefax 0123 5432139\nE-Mail Günter.Lässig@example.com<mailto:Günter.Lässig@example.com>\n\nExample. Zusammen für eine bessere Welt.\n[cid:image001.png@01CE92A6.EC495B60]<http://www.example.com/>\n\n[cid:image002.png@01CE92A6.EC495B60]<http://www.facebook.com/example.com>\n\n[cid:image003.png@01CE92A6.EC495B60]<http://twitter.com/example>\n\n[cid:image004.png@01CE92A6.EC495B60]<https://www.xing.com/companies/example/neu-example>\n\n[cid:image005.jpg@01CE92A6.EC495B60]<http://www.youtube.com/example>\n\n[cid:image006.png@01CE92A6.EC495B60]<http://www.example.com/no_cache/privatkunden/aktuelles/news-presse/newsletter.html>\n\nSitz der Gesellschaft: Max City, Amtsgericht Max City HRB Nr. 1234\nGeschäftsführer: Bob Smith\nVorsitzender des Aufsichtsrats: Alex Marx"
|
||||
assert_equal(expected_signature, signature)
|
||||
|
||||
fixture_files.keys.each do |filepath|
|
||||
expected_signature_position = fixture_files[filepath][:line]
|
||||
fixture_files.each do |_filepath, value|
|
||||
assert_equal(value[:line], SignatureDetection.find_signature_line(signature, value[:content], value[:content_type]))
|
||||
end
|
||||
end
|
||||
|
||||
assert_equal(expected_signature_position, SignatureDetection.find_signature_line(signature, fixture_files[filepath][:content]))
|
||||
test 'test case III - sender c' do
|
||||
|
||||
fixture_files = {
|
||||
'email_signature_detection/client_c_1.html' => { line: 8, content_type: 'text/html' },
|
||||
'email_signature_detection/client_c_2.html' => { line: 29, content_type: 'text/html' },
|
||||
'email_signature_detection/client_c_3.html' => { line: 9, content_type: 'text/html' },
|
||||
}
|
||||
|
||||
fixture_messages = []
|
||||
fixture_files.each do |filepath, value|
|
||||
value[:content] = File.new("#{Rails.root}/test/fixtures/#{filepath}", 'r').read
|
||||
fixture_messages.push value
|
||||
end
|
||||
|
||||
signature = SignatureDetection.find_signature(fixture_messages)
|
||||
expected_signature = "\nChristianSmith\nTechnik\n\nTel: +49 12 34 56 78 441\nFax: +49 12 34 56 78 499\nEmail: Christian.Smith@example.com\nWeb: www.example.com\nABC KFZ- und Flugzeug B.V. & Co. KG\nHauptverwaltung\nOst Straße 2\n12345 Somewhere"
|
||||
assert_equal(expected_signature, signature)
|
||||
|
||||
fixture_files.each do |filepath, value|
|
||||
assert_equal(value[:line], SignatureDetection.find_signature_line(signature, value[:content], value[:content_type]), filepath)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue