2 # BEGIN BPS TAGGED BLOCK {{{
6 # This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
9 # (Except where explicitly superseded by other copyright notices)
14 # This work is made available to you under the terms of Version 2 of
15 # the GNU General Public License. A copy of that license should have
16 # been provided with this software, but in any event can be snarfed
19 # This work is distributed in the hope that it will be useful, but
20 # WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 # General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 # 02110-1301 or visit their web page on the internet at
28 # http://www.gnu.org/copyleft/gpl.html.
31 # CONTRIBUTION SUBMISSION POLICY:
33 # (The following paragraph is not intended to limit the rights granted
34 # to you to modify and distribute this software under the terms of
35 # the GNU General Public License and is only of importance to you if
36 # you choose to contribute your changes and enhancements to the
37 # community by submitting them to Best Practical Solutions, LLC.)
39 # By intentionally submitting any modifications, corrections or
40 # derivatives to this work, or any other work intended for use with
41 # Request Tracker, to Best Practical Solutions, LLC, you confirm that
42 # you are the copyright holder for those contributions and you grant
43 # Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
44 # royalty-free, perpetual, license to use, copy, create derivative
45 # works based on those contributions, and sublicense and distribute
46 # those contributions and any derivatives thereof.
48 # END BPS TAGGED BLOCK }}}
52 rt-mailgate - Mail interface to RT3.
59 use RT::Test tests => 42;
61 # 12.0 is outlook 2007, 14.0 is 2010
62 for my $mailer ( 'Microsoft Office Outlook 12.0', 'Microsoft Outlook 14.0' ) {
63 diag "Test mail with multipart/alternative";
68 To: rt\@@{[RT->Config->Get('rtname')]}
69 Subject: outlook basic test
70 Content-Type: multipart/alternative;
71 boundary="----=_NextPart_000_0004_01CB045C.A5A075D0"
73 ------=_NextPart_000_0004_01CB045C.A5A075D0
74 Content-Type: text/plain;
76 Content-Transfer-Encoding: 7bit
87 ------=_NextPart_000_0004_01CB045C.A5A075D0
88 Content-Type: text/html;
90 Content-Transfer-Encoding: quoted-printable
92 <html>this is fake</html>
95 ------=_NextPart_000_0004_01CB045C.A5A075D0--
105 test_email( $text, $content,
106 $mailer . ' with multipart/alternative, \n\n are replaced' );
109 diag "Test mail with multipart/mixed, with multipart/alternative in it";
112 From: root\@localhost
114 To: rt\@@{[RT->Config->Get('rtname')]}
115 Subject: outlook basic test
116 Content-Type: multipart/mixed;
117 boundary="----=_NextPart_000_000F_01CB045E.5222CB40"
119 ------=_NextPart_000_000F_01CB045E.5222CB40
120 Content-Type: multipart/alternative;
121 boundary="----=_NextPart_001_0010_01CB045E.5222CB40"
124 ------=_NextPart_001_0010_01CB045E.5222CB40
125 Content-Type: text/plain;
127 Content-Transfer-Encoding: 7bit
138 ------=_NextPart_001_0010_01CB045E.5222CB40
139 Content-Type: text/html;
141 Content-Transfer-Encoding: quoted-printable
143 <html>this is fake</html>
145 ------=_NextPart_001_0010_01CB045E.5222CB40--
147 ------=_NextPart_000_000F_01CB045E.5222CB40
148 Content-Type: text/plain;
150 Content-Transfer-Encoding: quoted-printable
151 Content-Disposition: attachment;
154 this is the attachment! :)=0A=
156 ------=_NextPart_000_000F_01CB045E.5222CB40--
165 test_email( $text, $content,
166 $mailer . ' with multipart/multipart, \n\n are replaced' );
169 diag "Test mail with with outlook, but the content type is text/plain";
172 From: root\@localhost
174 To: rt\@@{[RT->Config->Get('rtname')]}
175 Subject: outlook basic test
176 Content-Type: text/plain; charset="us-ascii"
177 Content-Transfer-Encoding: 7bit
199 test_email( $text, $content,
200 $mailer . ' with only text/plain, \n\n are not replaced' );
204 diag "Test mail with with multipart/alternative but x-mailer is not outlook ";
207 From: root\@localhost
209 To: rt\@@{[RT->Config->Get('rtname')]}
210 Subject: outlook basic test
211 Content-Type: multipart/alternative;
212 boundary="----=_NextPart_000_0004_01CB045C.A5A075D0"
214 ------=_NextPart_000_0004_01CB045C.A5A075D0
215 Content-Type: text/plain;
217 Content-Transfer-Encoding: 7bit
228 ------=_NextPart_000_0004_01CB045C.A5A075D0
229 Content-Type: text/html;
231 Content-Transfer-Encoding: quoted-printable
233 <html>this is fake</html>
236 ------=_NextPart_000_0004_01CB045C.A5A075D0--
250 test_email( $text, $content, 'without outlook, \n\n are not replaced' );
254 my ( $text, $content, $msg ) = @_;
255 my ( $status, $id ) = RT::Test->send_via_mailgate($text);
256 is( $status >> 8, 0, "The mail gateway exited normally" );
257 ok( $id, "Created ticket" );
259 my $ticket = RT::Test->last_ticket;
260 isa_ok( $ticket, 'RT::Ticket' );
261 is( $ticket->Id, $id, "correct ticket id" );
262 is( $ticket->Subject, 'outlook basic test', "subject of ticket $id" );
263 my $txns = $ticket->Transactions;
264 $txns->Limit( FIELD => 'Type', VALUE => 'Create' );
265 my $txn = $txns->First;
267 is( $txn->Content, $content, $msg );