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 => 43;
60 my ($baseurl, $m) = RT::Test->started_ok;
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" if $ENV{'TEST_VERBOSE'};
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"
110 if $ENV{'TEST_VERBOSE'};
113 From: root\@localhost
115 To: rt\@@{[RT->Config->Get('rtname')]}
116 Subject: outlook basic test
117 Content-Type: multipart/mixed;
118 boundary="----=_NextPart_000_000F_01CB045E.5222CB40"
120 ------=_NextPart_000_000F_01CB045E.5222CB40
121 Content-Type: multipart/alternative;
122 boundary="----=_NextPart_001_0010_01CB045E.5222CB40"
125 ------=_NextPart_001_0010_01CB045E.5222CB40
126 Content-Type: text/plain;
128 Content-Transfer-Encoding: 7bit
139 ------=_NextPart_001_0010_01CB045E.5222CB40
140 Content-Type: text/html;
142 Content-Transfer-Encoding: quoted-printable
144 <html>this is fake</html>
146 ------=_NextPart_001_0010_01CB045E.5222CB40--
148 ------=_NextPart_000_000F_01CB045E.5222CB40
149 Content-Type: text/plain;
151 Content-Transfer-Encoding: quoted-printable
152 Content-Disposition: attachment;
155 this is the attachment! :)=0A=
157 ------=_NextPart_000_000F_01CB045E.5222CB40--
166 test_email( $text, $content,
167 $mailer . ' with multipart/multipart, \n\n are replaced' );
170 diag "Test mail with with outlook, but the content type is text/plain"
171 if $ENV{'TEST_VERBOSE'};
174 From: root\@localhost
176 To: rt\@@{[RT->Config->Get('rtname')]}
177 Subject: outlook basic test
178 Content-Type: text/plain; charset="us-ascii"
179 Content-Transfer-Encoding: 7bit
201 test_email( $text, $content,
202 $mailer . ' with only text/plain, \n\n are not replaced' );
206 diag "Test mail with with multipart/alternative but x-mailer is not outlook "
207 if $ENV{'TEST_VERBOSE'};
210 From: root\@localhost
212 To: rt\@@{[RT->Config->Get('rtname')]}
213 Subject: outlook basic test
214 Content-Type: multipart/alternative;
215 boundary="----=_NextPart_000_0004_01CB045C.A5A075D0"
217 ------=_NextPart_000_0004_01CB045C.A5A075D0
218 Content-Type: text/plain;
220 Content-Transfer-Encoding: 7bit
231 ------=_NextPart_000_0004_01CB045C.A5A075D0
232 Content-Type: text/html;
234 Content-Transfer-Encoding: quoted-printable
236 <html>this is fake</html>
239 ------=_NextPart_000_0004_01CB045C.A5A075D0--
253 test_email( $text, $content, 'without outlook, \n\n are not replaced' );
257 my ( $text, $content, $msg ) = @_;
258 my ( $status, $id ) = RT::Test->send_via_mailgate($text);
259 is( $status >> 8, 0, "The mail gateway exited normally" );
260 ok( $id, "Created ticket" );
262 my $ticket = RT::Test->last_ticket;
263 isa_ok( $ticket, 'RT::Ticket' );
264 is( $ticket->Id, $id, "correct ticket id" );
265 is( $ticket->Subject, 'outlook basic test', "subject of ticket $id" );
266 my $txns = $ticket->Transactions;
267 $txns->Limit( FIELD => 'Type', VALUE => 'Create' );
268 my $txn = $txns->First;
270 is( $txn->Content, $content, $msg );