summaryrefslogtreecommitdiff
path: root/rt/t/mail
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-07-02 21:11:29 -0700
committerIvan Kohler <ivan@freeside.biz>2013-07-02 21:11:29 -0700
commit3d0a1bb06b895c5be6e3f0517d355442a6b1e125 (patch)
tree84069ebc3254825b952a482e11cdbbbc69f6fe85 /rt/t/mail
parentf3b99c11d6eed33f467dda360180a698a85c54e8 (diff)
parentd62206a94d9d49ef96640e0a8ec492679f8345e9 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'rt/t/mail')
-rw-r--r--rt/t/mail/charsets-outgoing.t1
-rw-r--r--rt/t/mail/crypt-gnupg.t1
-rw-r--r--rt/t/mail/dashboards.t1
-rw-r--r--rt/t/mail/digest-attributes.t1
-rw-r--r--rt/t/mail/extractsubjecttag.t24
-rw-r--r--rt/t/mail/gateway.t55
-rw-r--r--rt/t/mail/gnupg-bad.t1
-rw-r--r--rt/t/mail/gnupg-incoming.t69
-rw-r--r--rt/t/mail/gnupg-outgoing-encrypted.t1
-rw-r--r--rt/t/mail/gnupg-outgoing-plain.t1
-rw-r--r--rt/t/mail/gnupg-outgoing-signed.t1
-rw-r--r--rt/t/mail/gnupg-outgoing-signed_encrypted.t1
-rw-r--r--rt/t/mail/gnupg-realmail.t1
-rw-r--r--rt/t/mail/gnupg-reverification.t1
-rw-r--r--rt/t/mail/gnupg-special.t1
-rw-r--r--rt/t/mail/mime_decoding.t45
-rw-r--r--rt/t/mail/multipart.t48
-rw-r--r--rt/t/mail/one-time-recipients.t1
-rw-r--r--rt/t/mail/outlook.t250
-rw-r--r--rt/t/mail/sendmail.t3
-rw-r--r--rt/t/mail/threading.t1
-rw-r--r--rt/t/mail/verp.t3
-rw-r--r--rt/t/mail/wrong_mime_charset.t1
23 files changed, 327 insertions, 185 deletions
diff --git a/rt/t/mail/charsets-outgoing.t b/rt/t/mail/charsets-outgoing.t
index e17dd983d..2fc91f2e0 100644
--- a/rt/t/mail/charsets-outgoing.t
+++ b/rt/t/mail/charsets-outgoing.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
use Encode;
diff --git a/rt/t/mail/crypt-gnupg.t b/rt/t/mail/crypt-gnupg.t
index c0a875644..ffb059706 100644
--- a/rt/t/mail/crypt-gnupg.t
+++ b/rt/t/mail/crypt-gnupg.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/dashboards.t b/rt/t/mail/dashboards.t
index 00cfc6acd..edd455300 100644
--- a/rt/t/mail/dashboards.t
+++ b/rt/t/mail/dashboards.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/digest-attributes.t b/rt/t/mail/digest-attributes.t
index 5b4560621..badd59b87 100644
--- a/rt/t/mail/digest-attributes.t
+++ b/rt/t/mail/digest-attributes.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use warnings;
use strict;
diff --git a/rt/t/mail/extractsubjecttag.t b/rt/t/mail/extractsubjecttag.t
index e76da6f82..14fab44b5 100644
--- a/rt/t/mail/extractsubjecttag.t
+++ b/rt/t/mail/extractsubjecttag.t
@@ -1,9 +1,8 @@
-#!/usr/bin/perl
use strict;
use warnings;
use utf8;
-use RT::Test tests => 13;
+use RT::Test tests => 18;
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
@@ -84,3 +83,24 @@ EOF
}
+diag "Test that extraction of another RT's subject tag grabs only tag";
+{
+ my $ticketid = $original_ticket->Id;
+ my $text = <<EOF;
+From: root\@localhost
+To: general\@$RT::rtname
+Subject: [$subject_tag #$ticketid] [comment] [remote-rt-system #79] test
+
+reply with subject tag and remote rt subject tag
+EOF
+ my ($status, $id) = RT::Test->send_via_mailgate($text, queue => $queue->Name);
+ is ($status >> 8, 0, "The mail gateway exited normally");
+ is ($id, $ticketid, "Replied to ticket $id correctly");
+
+ my $freshticket = RT::Ticket->new( RT->SystemUser );
+ $freshticket->LoadById($id);
+ like($freshticket->Subject,qr/\[remote-rt-system #79\]/,"Kept remote rt's subject tag");
+ unlike($freshticket->Subject,qr/comment/,"doesn't grab comment");
+ unlike($freshticket->Subject,qr/\[\Q$subject_tag\E #$ticketid\]/,'Stripped Queue Subject Tag correctly');
+}
+
diff --git a/rt/t/mail/gateway.t b/rt/t/mail/gateway.t
index 98eabd56e..9482ffcb2 100644
--- a/rt/t/mail/gateway.t
+++ b/rt/t/mail/gateway.t
@@ -1,58 +1,3 @@
-#!/usr/bin/perl -w
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
-# <jesse.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-
-=head1 NAME
-
-rt-mailgate - Mail interface to RT3.
-
-=cut
-
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-bad.t b/rt/t/mail/gnupg-bad.t
index c9b28c902..a1c45be05 100644
--- a/rt/t/mail/gnupg-bad.t
+++ b/rt/t/mail/gnupg-bad.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-incoming.t b/rt/t/mail/gnupg-incoming.t
index e591add6c..48d2d9b73 100644
--- a/rt/t/mail/gnupg-incoming.t
+++ b/rt/t/mail/gnupg-incoming.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
@@ -11,7 +10,7 @@ BEGIN {
}
use RT::Test::GnuPG
- tests => 41,
+ tests => 53,
actual_server => 1,
gnupg_options => {
passphrase => 'rt-test',
@@ -20,6 +19,7 @@ use RT::Test::GnuPG
use String::ShellQuote 'shell_quote';
use IPC::Run3 'run3';
+use MIME::Base64;
my ($baseurl, $m) = RT::Test->started_ok;
@@ -196,6 +196,43 @@ RT::Test->close_mailgate_ok($mail);
ok(index($orig->Content, $buf) != -1, 'found original msg');
}
+
+# test that if it gets base64 transfer-encoded, we still get the content out
+$buf = encode_base64($buf);
+$mail = RT::Test->open_mailgate_ok($baseurl);
+print $mail <<"EOF";
+From: recipient\@example.com
+To: general\@$RT::rtname
+Content-transfer-encoding: base64
+Subject: Encrypted message for queue
+
+$buf
+EOF
+RT::Test->close_mailgate_ok($mail);
+
+{
+ my $tick = RT::Test->last_ticket;
+ is( $tick->Subject, 'Encrypted message for queue',
+ "Created the ticket"
+ );
+
+ my $txn = $tick->Transactions->First;
+ my ($msg, $attach, $orig) = @{$txn->Attachments->ItemsArrayRef};
+
+ is( $msg->GetHeader('X-RT-Incoming-Encryption'),
+ 'Success',
+ 'recorded incoming mail that is encrypted'
+ );
+ is( $msg->GetHeader('X-RT-Privacy'),
+ 'PGP',
+ 'recorded incoming mail that is encrypted'
+ );
+ like( $attach->Content, qr/orz/);
+
+ is( $orig->GetHeader('Content-Type'), 'application/x-rt-original-message');
+ ok(index($orig->Content, $buf) != -1, 'found original msg');
+}
+
# test for signed mail by other key
$buf = '';
@@ -307,3 +344,31 @@ is(@mail, 1, 'caught outgoing mail.');
unlike( ($attach ? $attach->Content : ''), qr/really should not be there either/);
}
+
+# test that if it gets base64 transfer-encoded long mail then it doesn't hang
+{
+ local $SIG{ALRM} = sub {
+ ok 0, "timed out, web server is probably in deadlock";
+ exit;
+ };
+ alarm 30;
+ $buf = encode_base64('a'x(250*1024));
+ $mail = RT::Test->open_mailgate_ok($baseurl);
+ print $mail <<"EOF";
+From: recipient\@example.com
+To: general\@$RT::rtname
+Content-transfer-encoding: base64
+Subject: Long not encrypted message for queue
+
+$buf
+EOF
+ RT::Test->close_mailgate_ok($mail);
+ alarm 0;
+
+ my $tick = RT::Test->last_ticket;
+ is( $tick->Subject, 'Long not encrypted message for queue',
+ "Created the ticket"
+ );
+ my $content = $tick->Transactions->First->Content;
+ like $content, qr/a{1024,}/, 'content is not lost';
+}
diff --git a/rt/t/mail/gnupg-outgoing-encrypted.t b/rt/t/mail/gnupg-outgoing-encrypted.t
index 4f2a28f55..96c748794 100644
--- a/rt/t/mail/gnupg-outgoing-encrypted.t
+++ b/rt/t/mail/gnupg-outgoing-encrypted.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-outgoing-plain.t b/rt/t/mail/gnupg-outgoing-plain.t
index ee9a8ac81..62ae0ed49 100644
--- a/rt/t/mail/gnupg-outgoing-plain.t
+++ b/rt/t/mail/gnupg-outgoing-plain.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-outgoing-signed.t b/rt/t/mail/gnupg-outgoing-signed.t
index 2ea20a2d7..4aa262bee 100644
--- a/rt/t/mail/gnupg-outgoing-signed.t
+++ b/rt/t/mail/gnupg-outgoing-signed.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-outgoing-signed_encrypted.t b/rt/t/mail/gnupg-outgoing-signed_encrypted.t
index 0b82cf1ca..806f62d95 100644
--- a/rt/t/mail/gnupg-outgoing-signed_encrypted.t
+++ b/rt/t/mail/gnupg-outgoing-signed_encrypted.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-realmail.t b/rt/t/mail/gnupg-realmail.t
index 7d1dbcab5..834014ccc 100644
--- a/rt/t/mail/gnupg-realmail.t
+++ b/rt/t/mail/gnupg-realmail.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-reverification.t b/rt/t/mail/gnupg-reverification.t
index 96a37a080..939bf3333 100644
--- a/rt/t/mail/gnupg-reverification.t
+++ b/rt/t/mail/gnupg-reverification.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-special.t b/rt/t/mail/gnupg-special.t
index 7dd63478a..15aad3489 100644
--- a/rt/t/mail/gnupg-special.t
+++ b/rt/t/mail/gnupg-special.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/mime_decoding.t b/rt/t/mail/mime_decoding.t
index 7515e2c41..4b3e3c075 100644
--- a/rt/t/mail/mime_decoding.t
+++ b/rt/t/mail/mime_decoding.t
@@ -1,7 +1,6 @@
-#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test nodb => 1, tests => 9;
+use RT::Test nodb => 1, tests => 13;
use_ok('RT::I18N');
@@ -97,3 +96,45 @@ diag q{canonicalize mime word encodings like gb2312};
);
}
+
+diag q{Whitespace between encoded words should be removed};
+{
+ my $str = "=?utf-8?Q?=E3=82=AD?= =?utf-8?Q?=E3=83=A3?=";
+ is(
+ RT::I18N::DecodeMIMEWordsToUTF8($str),
+ "キャ",
+ "whitespace between encoded words is removed",
+ );
+
+ $str = "=?utf-8?Q?=E3=82=AD?= \n =?utf-8?Q?=E3=83=A3?=";
+ is(
+ RT::I18N::DecodeMIMEWordsToUTF8($str),
+ "キャ",
+ "newlines between encoded words also removed",
+ );
+}
+
+diag q{Multiple octets split across QP hunks are correctly reassembled};
+{
+ # This passes even without explicit code to handle it because utf8
+ # is perl's internal string encoding.
+ my $str = "=?utf-8?Q?=E3?= =?utf-8?Q?=82?= =?utf-8?Q?=AD?=";
+ is(
+ RT::I18N::DecodeMIMEWordsToUTF8($str),
+ "キ",
+ "UTF8 character split in three is successfully reassembled",
+ );
+
+ # Non-utf8 encodings thus also must be checked
+ $str = <<EOT; chomp $str;
+=?gb2312?q?Chinese(gb2312)=20=20=C3=C0=B9=FA=C7=B0=CB=BE=B7=A8=B2=BF=B3?=
+ =?gb2312?q?=A4=C3=E6=BC=FB=C8=F8=B4=EF=C4=B7=BA=F3=B3=C6=C6=E4=D7=B4=CC=AC?=
+ =?gb2312?q?=BA=DC=BA=C3=20=20Chinese=20(gb2312)?=
+EOT
+ is(
+ RT::I18N::DecodeMIMEWordsToUTF8($str),
+ "Chinese(gb2312) 美国前司法部长面见萨达姆后称其状态很好 Chinese (gb2312)",
+ "gb2312 character is successfully reassembled",
+ );
+
+}
diff --git a/rt/t/mail/multipart.t b/rt/t/mail/multipart.t
index a68710a75..1c1106421 100644
--- a/rt/t/mail/multipart.t
+++ b/rt/t/mail/multipart.t
@@ -1,51 +1,3 @@
-#!/usr/bin/perl -w
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
-# <jesse.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
use strict;
use warnings;
diff --git a/rt/t/mail/one-time-recipients.t b/rt/t/mail/one-time-recipients.t
index 985f95562..3484d1470 100644
--- a/rt/t/mail/one-time-recipients.t
+++ b/rt/t/mail/one-time-recipients.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
use utf8;
diff --git a/rt/t/mail/outlook.t b/rt/t/mail/outlook.t
index 00bbc9445..752a91fae 100644
--- a/rt/t/mail/outlook.t
+++ b/rt/t/mail/outlook.t
@@ -1,62 +1,9 @@
-#!/usr/bin/perl -w
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
-# <jesse.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-
-=head1 NAME
-
-rt-mailgate - Mail interface to RT3.
-
-=cut
-
use strict;
use warnings;
-use RT::Test tests => 42;
+use RT::Test tests => 66;
+
+RT->Config->Set('CheckMoreMSMailHeaders', 1);
# 12.0 is outlook 2007, 14.0 is 2010
for my $mailer ( 'Microsoft Office Outlook 12.0', 'Microsoft Outlook 14.0' ) {
@@ -199,8 +146,75 @@ EOF
test_email( $text, $content,
$mailer . ' with only text/plain, \n\n are not replaced' );
}
+
+ diag "Test mail with with outlook, content type is base64";
+ {
+ my $text = <<EOF;
+From: root\@localhost
+X-Mailer: $mailer
+To: rt\@@{[RT->Config->Get('rtname')]}
+Subject: outlook basic test
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: base64
+
+VGhpcyBpcyB0aGUgYm9keSBvZiBhbiBlbWFpbC4KCkl0IGhhcyBtdWx0aXBs
+ZSBleHRyYSBuZXdsaW5lcy4KCgoKTGlrZSBhIG1hbmdsZWQgT3V0bG9vayBt
+ZXNzYWdlIG1pZ2h0LgoKCgpKb2huIFNtaXRoCgpTb21lIENvbXBhbnkKCmVt
+YWlsQHNvbWVjby5jb20KCg==
+EOF
+
+ my $content = <<EOF;
+This is the body of an email.
+It has multiple extra newlines.
+
+Like a mangled Outlook message might.
+
+John Smith
+Some Company
+email\@someco.com
+EOF
+ test_email( $text, $content,
+ $mailer . ' with base64, \n\n are replaced' );
+ }
+}
+
+# In a sample we received, the two X-MS- headers included
+# below were both present and had no values. For now, using
+# the existence of these headers as evidence of MS Outlook
+# or Exchange.
+
+diag "Test mail with with outlook, no X-Mailer, content type is base64";
+{
+ my $text = <<EOF;
+From: root\@localhost
+To: rt\@@{[RT->Config->Get('rtname')]}
+Subject: outlook basic test
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: base64
+X-MS-Has-Attach:
+X-MS-Tnef-Correlator:
+
+VGhpcyBpcyB0aGUgYm9keSBvZiBhbiBlbWFpbC4KCkl0IGhhcyBtdWx0aXBs
+ZSBleHRyYSBuZXdsaW5lcy4KCgoKTGlrZSBhIG1hbmdsZWQgT3V0bG9vayBt
+ZXNzYWdlIG1pZ2h0LgoKCgpKb2huIFNtaXRoCgpTb21lIENvbXBhbnkKCmVt
+YWlsQHNvbWVjby5jb20KCg==
+EOF
+
+ my $content = <<EOF;
+This is the body of an email.
+It has multiple extra newlines.
+
+Like a mangled Outlook message might.
+
+John Smith
+Some Company
+email\@someco.com
+EOF
+ test_email( $text, $content,
+ ' with base64, no X-Mailer, \n\n are replaced' );
}
+
diag "Test mail with with multipart/alternative but x-mailer is not outlook ";
{
my $text = <<EOF;
@@ -234,7 +248,6 @@ Content-Transfer-Encoding: quoted-printable
------=_NextPart_000_0004_01CB045C.A5A075D0--
-
EOF
my $content = <<EOF;
@@ -250,6 +263,129 @@ EOF
test_email( $text, $content, 'without outlook, \n\n are not replaced' );
}
+diag "Sample multipart email with Exchange headers";
+{
+ my $text = <<EOF;
+X-MimeOLE: Produced By Microsoft Exchange V6.5
+Received: by example.com
+ id <01CD63FC.33F4C15C\@example.com>; Tue, 17 Jul 2012 10:11:51 +0100
+MIME-Version: 1.0
+Content-Type: multipart/alternative;
+ boundary="----_=_NextPart_001_01CD63FC.33F4C15C"
+Content-class: urn:content-classes:message
+Subject: outlook basic test
+Date: Tue, 17 Jul 2012 10:11:50 +0100
+Message-ID: <AA6CEAFB02FF244999046B2A6B6B9D6F05FF9D12\@example.com>
+X-MS-Has-Attach:
+X-MS-TNEF-Correlator:
+Thread-Topic: Testing Outlook HTML
+Thread-Index: Ac1j/DNs7ly963bnRt63SJw9DkGwyw==
+From: root\@localhost
+To: rt\@@{[RT->Config->Get('rtname')]}
+
+This is a multi-part message in MIME format.
+
+------_=_NextPart_001_01CD63FC.33F4C15C
+Content-Type: text/plain;
+ charset="us-ascii"
+Content-Transfer-Encoding: quoted-printable
+
+This email contains a line of text containing multiple sentences. Where
+will RT wrap this when the text is quoted? What about the footer below?
+
+=20
+
+This is a different line, with a blank line (paragraph) above. Will
+there be additional blank lines when the text is quoted?
+
+=20
+
+This isthesig
+
+=20
+
+
+------_=_NextPart_001_01CD63FC.33F4C15C
+Content-Type: text/html;
+ charset="us-ascii"
+Content-Transfer-Encoding: quoted-printable
+
+<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
+xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
+xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
+xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
+xmlns=3D"http://www.w3.org/TR/REC-html40"><head><META =
+HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
+charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 12 =
+(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:0in;
+ margin-bottom:.0001pt;
+ font-size:11.0pt;
+ font-family:"Calibri","sans-serif";}
+a:link, span.MsoHyperlink
+ {mso-style-priority:99;
+ color:blue;
+ text-decoration:underline;}
+a:visited, span.MsoHyperlinkFollowed
+ {mso-style-priority:99;
+ color:purple;
+ text-decoration:underline;}
+span.EmailStyle17
+ {mso-style-type:personal-compose;
+ font-family:"Calibri","sans-serif";
+ color:windowtext;}
+.MsoChpDefault
+ {mso-style-type:export-only;}
+\@page WordSection1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.0in 1.0in 1.0in;}
+div.WordSection1
+ {page:WordSection1;}
+--></style><!--[if gte mso 9]><xml>
+<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
+</xml><![endif]--><!--[if gte mso 9]><xml>
+<o:shapelayout v:ext=3D"edit">
+<o:idmap v:ext=3D"edit" data=3D"1" />
+</o:shapelayout></xml><![endif]--></head><body lang=3DEN-US link=3Dblue =
+vlink=3Dpurple><div class=3DWordSection1><p class=3DMsoNormal>This email =
+contains a line of text containing multiple sentences.&nbsp; Where will =
+RT wrap this when the text is quoted?&nbsp; What about the footer =
+below?<o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
+class=3DMsoNormal>This is a different line, with a blank line =
+(paragraph) above.&nbsp; Will there be additional blank lines when the =
+text is quoted?<o:p></o:p></p><p =
+class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal><span =
+lang=3DEN-GB =
+style=3D'font-size:7.5pt;font-family:"Arial","sans-serif"'>This isthesig =
+</span><o:p></o:p></p><p =
+class=3DMsoNormal><o:p>&nbsp;</o:p></p></div></body></html>
+------_=_NextPart_001_01CD63FC.33F4C15C--
+EOF
+
+ my $content = <<EOF;
+This email contains a line of text containing multiple sentences. Where
+will RT wrap this when the text is quoted? What about the footer below?
+
+This is a different line, with a blank line (paragraph) above. Will
+there be additional blank lines when the text is quoted?
+
+This isthesig
+
+EOF
+
+ test_email( $text, $content,
+ 'Another sample multipart message with Exchange headers' );
+}
+
sub test_email {
my ( $text, $content, $msg ) = @_;
my ( $status, $id ) = RT::Test->send_via_mailgate($text);
diff --git a/rt/t/mail/sendmail.t b/rt/t/mail/sendmail.t
index bb5d2db80..44903f375 100644
--- a/rt/t/mail/sendmail.t
+++ b/rt/t/mail/sendmail.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl -w
-
use strict;
+use warnings;
use File::Spec ();
use RT::Test tests => 141;
diff --git a/rt/t/mail/threading.t b/rt/t/mail/threading.t
index 7112ecf07..773b7207f 100644
--- a/rt/t/mail/threading.t
+++ b/rt/t/mail/threading.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
use utf8;
diff --git a/rt/t/mail/verp.t b/rt/t/mail/verp.t
index ed3af6a7b..a07f80079 100644
--- a/rt/t/mail/verp.t
+++ b/rt/t/mail/verp.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl -w
-
use strict;
+use warnings;
use RT::Test nodb => 1, tests => 1;
TODO: {
todo_skip "No tests written for VERP yet", 1;
diff --git a/rt/t/mail/wrong_mime_charset.t b/rt/t/mail/wrong_mime_charset.t
index 511a7e61d..530b5f38d 100644
--- a/rt/t/mail/wrong_mime_charset.t
+++ b/rt/t/mail/wrong_mime_charset.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
use RT::Test nodb => 1, tests => 6;