芝麻web文件管理V1.00
';
$icsText = 'BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//icalcreator//NONSGML iCalcreator 2.22//
METHOD:REQUEST
BEGIN:VEVENT
UID:77@localhost
DTSTAMP:20160208T170811Z
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
TRUE;CN=Jacob Alvarez:MAILTO:fake1@mailinator.com
CREATED:20160208T170810Z
DTSTART:20160215T180000Z
DTEND:20160215T190000Z
ORGANIZER;CN=-:MAILTO:fake2@mailinator.com
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:Prueba 69
TRANSP:OPAQUE
URL:http://localhost/event/77
END:VEVENT
END:VCALENDAR';
function printPartsStartAndEnd($body) {
$matches = array();
preg_match_all('/--(=_[a-z0-9]+)--|Content-Type: ([^;\r\n]+)/', $body, $matches);
$tab = " ";
foreach ($matches[0] as $match){
if (strpos($match, '--') === false) {
printf("%s%s\n", $tab, $match);
if (stripos($match, "multipart")) {
$tab .= " ";
}
} else {
$tab = substr($tab, 0, -4);
printf("%sEnd part\n", $tab);
}
}
}
function printHeaderContentType($headers) {
$headerContentType = array();
preg_match('/([^;\r\n]+)/', $headers['Content-Type'], $headerContentType);
printf("Content-Type: %s\n", $headerContentType[0]);
}
print "TEST: text\n";
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: html\n";
$mime = new Mail_mime();
$mime->setHTMLBody($htmlBody);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: attachments\n";
$mime = new Mail_mime();
$mime->addAttachment($icsText, 'application/ics', 'invite.ics', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: text + attachments\n";
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->addAttachment($icsText, 'application/ics', 'invite.ics', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: html + attachments\n";
$mime = new Mail_mime();
$mime->setHTMLBody($htmlBody);
$mime->addAttachment($icsText, 'application/ics', 'invite.ics', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: html + inline images\n";
$mime = new Mail_mime();
$mime->setHTMLBody($htmlBody);
$mime->addHTMLImage("aaaaaaaaaa", 'image/gif', 'image.gif', false, 'contentid');
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print("TEST: txt, html and attachment\n");
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->setHTMLBody($htmlBody);
$mime->addAttachment("test", 'application/octet-stream', 'attachment', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: calendar\n";
$mime = new Mail_mime();
$mime->setCalendarBody($icsText);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: txt + calendar\n";
$mime->setTXTBody($txtBody);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: txt, html, calendar\n";
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->setHTMLBody($htmlBody);
$mime->setCalendarBody($icsText);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: txt, html + html images, and calendar\n";
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->setHTMLBody($htmlBody);
$mime->addHTMLImage('testimage', 'image/gif', "bus.gif", false);
$mime->setCalendarBody($icsText);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print("TEST: txt, html, calendar and attachment\n");
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->setHTMLBody($htmlBody);
$mime->setCalendarBody($icsText);
$mime->addAttachment("test", 'application/octet-stream', 'attachment', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
print "TEST: txt, html + html images, calendar, and attachment\n";
$mime = new Mail_mime();
$mime->setTXTBody($txtBody);
$mime->setHTMLBody($htmlBody);
$mime->addHTMLImage('testimage', 'image/gif', "bus.gif", false);
$mime->setCalendarBody($icsText);
$mime->addAttachment($icsText, 'application/ics', 'invite.ics', false);
$headers = $mime->headers();
$body = $mime->get();
printHeaderContentType($headers);
printPartsStartAndEnd($body);
print("\n");
?>
--EXPECT--
TEST: text
Content-Type: text/plain
TEST: html
Content-Type: text/html
TEST: attachments
Content-Type: multipart/mixed
Content-Type: application/ics
End part
TEST: text + attachments
Content-Type: multipart/mixed
Content-Type: text/plain
Content-Type: application/ics
End part
TEST: html + attachments
Content-Type: multipart/mixed
Content-Type: text/html
Content-Type: application/ics
End part
TEST: html + inline images
Content-Type: multipart/related
Content-Type: text/html
Content-Type: image/gif
End part
TEST: txt, html and attachment
Content-Type: multipart/mixed
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: text/html
End part
Content-Type: application/octet-stream
End part
TEST: calendar
Content-Type: text/calendar
TEST: txt + calendar
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: text/calendar
End part
TEST: txt, html, calendar
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: text/html
Content-Type: text/calendar
End part
TEST: txt, html + html images, and calendar
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: multipart/related
Content-Type: text/html
Content-Type: image/gif
End part
Content-Type: text/calendar
End part
TEST: txt, html, calendar and attachment
Content-Type: multipart/mixed
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: text/html
Content-Type: text/calendar
End part
Content-Type: application/octet-stream
End part
TEST: txt, html + html images, calendar, and attachment
Content-Type: multipart/mixed
Content-Type: multipart/alternative
Content-Type: text/plain
Content-Type: multipart/related
Content-Type: text/html
Content-Type: image/gif
End part
Content-Type: text/calendar
End part
Content-Type: application/ics
End part
PK eqYi; tests/test_Bug_7561_1.phptnu [ --TEST--
Bug #7561 Mail_mimePart::quotedPrintableEncode() misbehavior with mbstring overload
--INI--
mbstring.language=Neutral
mbstring.func_overload=6
mbstring.internal_encoding=UTF-8
mbstring.http_output=UTF-8
--SKIPIF--
';
$mime->setHTMLBody($body);
$mime->setFrom($from);
$mime->addHTMLImage('','image/gif', 'test.gif', false);
$msg=$mime->get();
$header = preg_match('|Content-ID: <[0-9a-fA-F]+@from.example.com>|', $msg);
if (!$header){
print("FAIL:\n");
print($msg);
}else{
print("OK");
}
--EXPECT--
OK
PK eqYQi"- - tests/test_Bug_11381.phptnu [ --TEST--
Bug #11381 Domain name is attached to content-id, trailing greater-than sign is not removed
--SKIPIF--
--FILE--
';
require_once('Mail/mime.php');
$mime=new Mail_mime();
$body='';
$mime->setHTMLBody($body);
$mime->setFrom($from);
$mime->addHTMLImage('','image/gif', 'test.gif', false);
$msg=$mime->get();
$header = preg_match('|Content-ID: <[0-9a-fA-F]+@from.example.com>|', $msg);
if (!$header){
print("FAIL:\n");
print($msg);
}else{
print("OK");
}
--EXPECT--
OK
PK eqY'' ' tests/test_Bug_8386_1.phptnu [ --TEST--
Bug #8386 HTML body not correctly encoded if attachments present
--SKIPIF--
--FILE--
$eol));
$encoder->setTXTBody('test');
$encoder->setHTMLBody('test');
$encoder->addAttachment('Just a test', 'application/octet-stream', 'test.txt', false);
$body = $encoder->get();
if (strpos($body, '--' . $eol . '--=')){
print("FAILED\n");
print("Single delimiter() between 2 parts found.\n");
print($body);
}else{
print("OK");
}
?>
--EXPECT--
OK
PK eqYe;I tests/test_Bug_21205.phptnu [ --TEST--
Bug #21205 Handling ISO-2022-JP headers
--SKIPIF--
';
$charset = 'ISO-2022-JP';
$encoding = 'base64';
foreach ($tests as $test) {
$test = mb_convert_encoding($test, $charset, 'UTF-8');
print Mail_mimePart::encodeHeader("subject", $test, $charset, $encoding) . PHP_EOL;
print Mail_mimePart::encodeHeader("to", $test.$addr, $charset, $encoding) . PHP_EOL;
$test = '"' . $test . '"';
print Mail_mimePart::encodeHeader("subject", $test, $charset, $encoding) . PHP_EOL;
print Mail_mimePart::encodeHeader("to", $test.$addr, $charset, $encoding) . PHP_EOL;
}
?>
--EXPECT--
=?ISO-2022-JP?B?GyRCIiI1fkVUSVwiIhsoQg==?=
=?ISO-2022-JP?B?GyRCIiI1fkVUSVwiIhsoQg==?=
=?ISO-2022-JP?B?GyRCIiI1fkVUSVwiIhsoQg==?=
=?ISO-2022-JP?B?GyRCIiI1fkVUSVwiIhsoQg==?=
=?ISO-2022-JP?B?GyRCIlwiXCJcIlwbKEI=?=
=?ISO-2022-JP?B?GyRCIlwiXCJcIlwbKEI=?=
=?ISO-2022-JP?B?GyRCIlwiXCJcIlwbKEI=?=
=?ISO-2022-JP?B?GyRCIlwiXCJcIlwbKEI=?=
PK eqYM-\ tests/test_Bug_17175.phptnu [ --TEST--
Bug #17175 Content-Description support+ecoding
--SKIPIF--
--FILE--
setTXTBody('Test message.');
$Mime->addAttachment('test file contents', "text/plain",
'test.txt', FALSE, 'base64', NULL, 'UTF-8', NULL, NULL, NULL, NULL,
'desc');
$Mime->addAttachment('test file contents', "text/plain",
'test2.txt', FALSE, 'base64', NULL, 'UTF-8', NULL, NULL, NULL, NULL,
'test unicode żąśź');
$body = $Mime->getMessage();
preg_match_all('/Content-Description: (.*)/', $body, $matches);
foreach ($matches[1] as $value)
echo $value."\n";
?>
--EXPECT--
desc
=?UTF-8?Q?test_unicode_=C5=BC=C4=85=C5=9B=C5=BA?=
PK eqY[b $ tests/content_transfer_encoding.phptnu [ --TEST--
Test empty Content-Transfer-Encoding on multipart messages
--SKIPIF--
--FILE--
setParam('text_encoding', 'quoted-printable');
$mime->setParam('html_encoding', 'quoted-printable');
$mime->setParam('head_encoding', 'quoted-printable');
// This specific order used to set Content-Transfer-Encoding: quoted-printable
// which is invalid according to RFC 2045 on multipart messages
$mime->setTXTBody('text');
$mime->headers(array('From' => 'from@domain.tld'));
$mime->addAttachment('file.pdf', 'application/pdf', 'file.pdf', false, 'base64', 'inline');
echo $mime->txtHeaders();
list ($header, $body) = explode("\r\n\r\n", $mime->getMessage());
echo $header;
?>
--EXPECTF--
MIME-Version: 1.0
From: from@domain.tld
Content-Type: multipart/mixed;
boundary="=_%x"
MIME-Version: 1.0
From: from@domain.tld
Content-Type: multipart/mixed;
boundary="=_%x"
PK eqYّ B
tests/qp_encoding_test.phptnu [ --TEST--
qp comprehensive test
--SKIPIF--
--FILE--
setFrom('user@from.example.com');
$r = $mime->txtHeaders(array('Received' => array('Received 1', 'Received 2')));
print_r($r);
?>
--EXPECT--
Received: Received 1
Received: Received 2
MIME-Version: 1.0
From: user@from.example.com
PK eqYRoU U tests/test_Bug_20226.phptnu [ --TEST--
Bug #20226 Mail_mimePart::encodeHeader() and ISO-2022-JP encoding
--SKIPIF--
--FILE--
encodeHeader('subject', $subject, 'ISO-2022-JP', 'base64');
?>
--EXPECT--
=?ISO-2022-JP?B?GyRCJT8lJCVIJWsbKEI=?=
PK eqYYcLY Y tests/test_Bug_16539.phptnu [ --TEST--
Bug #16539 Headers longer than 998 characters
--SKIPIF--
--FILE--
'jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com',
'Subject' => 'jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com',
);
echo $mime->txtHeaders($headers, true, true);
?>
--EXPECT--
MIME-Version: 1.0
To: jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com, jskibbie@schawk.com,
jskibbie@schawk.com, jskibbie@schawk.com
Subject: jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.co
m,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com,jskibbie@schawk.com
PK eqYo tests/test_Bug_14529.phptnu [ --TEST--
Bug #14529 basename() workaround
--SKIPIF--
--FILE--
addAttachment('testfile', "text/plain", $filename, FALSE, 'base64', 'attachment', 'ISO-8859-1');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match('/filename([^\s]+)/i', $content, $matches)) {
echo $matches[1];
}
?>
--EXPECT--
*=ISO-8859-1''%C5%9Bciema;
PK eqY9: : tests/test_Bug_10816_1.phptnu [ --TEST--
Bug #10816 Unwanted linebreak at the end of output
--SKIPIF--
--FILE--
$eol));
$encoder->setTXTBody('test');
$encoder->setHTMLBody('test');
$encoder->addAttachment('Just a test', 'application/octet-stream', 'test.txt', false);
$body = $encoder->get();
$taillength = -1 * strlen($eol) * 2;
if (substr($body, $taillength) == ($eol.$eol)){
print("FAILED\n");
print("Body:\n");
print("..." . substr($body, -10) . "\n");
}else{
print("OK\n");
}
--EXPECT--
OK
PK eqYܶgh h tests/test_Bug_9722_1.phptnu [ --TEST--
Bug #9722 quotedPrintableEncode does not encode dot at start of line on Windows platform
--SKIPIF--
--FILE--
isMultipart() ? 'TRUE' : 'FALSE') . "\n";
$mime->setTXTBody('test');
echo ($mime->isMultipart() ? 'TRUE' : 'FALSE') . "\n";
$mime->setHTMLBody('test');
echo ($mime->isMultipart() ? 'TRUE' : 'FALSE') . "\n";
--EXPECT--
FALSE
FALSE
TRUE
PK eqYYak! ! ) tests/sleep_wakeup_EOL-bug3488-part1.phptnu [ --TEST--
Bug #3488 Sleep/Wakeup EOL Consistency - Part 1
--SKIPIF--
--FILE--
setHTMLBody('');
$mm->setTxtBody('Blah blah');
if (version_compare(phpversion(), "5.0.0", '<')) {
$mmCopy = $mm;
} else {
$mmCopy = clone($mm);
}
$mm->get();
$x = $mm->headers();
$smm = serialize(array('mm' => $mmCopy, 'header' => $x['Content-Type']));
$fp = fopen('sleep_wakeup_data', 'w');
fwrite($fp, $smm);
fclose($fp);
echo "Data written";
?>
--EXPECT--
Data written
PK eqYzŬ tests/test_Bug_11731.phptnu [ --TEST--
Bug #11731 Full stops after soft line breaks are not encoded
--SKIPIF--
--FILE--
'text/plain',
'encoding' => 'quoted-printable',
);
$mimePart = new Mail_mimePart($text, $params);
$encoded = $mimePart->encode();
echo $encoded['body'];
--EXPECT--
=2E123456789012345678901234567890123456789012345678901234567890123456789012=
=2E3456
PK eqYY tests/test_Bug_GH26.phptnu [ --TEST--
Bug GH-26 Backward slash is getting added in headers
--SKIPIF--
--FILE--
';
$to = <<,,t@mail.com
EOT;
$subject = "Test mime";
$mailbody = "hello world";
$mail_mime->setTxtBody($mailbody);
$mail_mime->setHTMLBody($mailbody);
$mail_mime->setSubject($subject);
$mail_mime->setFrom($from);
$body = $mail_mime->get();
$extra_headers = array();
$extra_headers["To"] = $to;
$arr_hdrs = $mail_mime->headers($extra_headers);
echo $arr_hdrs['From'] . "\n" . $arr_hdrs['To'];
--EXPECT--
"George B@@Z"
"austin test" , , t@mail.comPK eqY%B B tests/test_Bug_GH16.phptnu [ --TEST--
Bug GH-16 Test methods that write to a file
--SKIPIF--
--FILE--
setHTMLBody('html');
$mime->setTXTBody('text');
$mime->setContentType('multipart/alternative', array('boundary' => 'something'));
$temp_filename = dirname(__FILE__) . "/output1.tmp";
touch($temp_filename);
$msg = $mime->saveMessageBody($temp_filename);
echo file_get_contents($temp_filename);
$temp_filename = dirname(__FILE__) . "/output2.tmp";
touch($temp_filename);
$msg = $mime->saveMessage($temp_filename);
echo file_get_contents($temp_filename);
$temp_filename = dirname(__FILE__) . "/output3.tmp";
$mimePart = new Mail_mimePart('abc', array(
'content_type' => 'text/plain',
'encoding' => 'quoted-printable',
));
$mimePart->encodeToFile($temp_filename);
echo file_get_contents($temp_filename);
?>
--CLEAN--
--EXPECT--
--something
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
text
--something
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1
html
--something--
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="something"
--something
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
text
--something
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1
html
--something--
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain
abc
PK eqY-b2 tests/test_Bug_13032.phptnu [ --TEST--
Bug #13032 Proper (different) boundary for nested parts
--SKIPIF--
--FILE--
setHTMLBody('html');
$mime->setTXTBody('text');
$mime->addAttachment('file.pdf', 'application/pdf', 'file.pdf', false, 'base64', 'inline');
$msg = $mime->getMessage();
if (preg_match_all('/boundary="([^"]+)"/', $msg, $matches)) {
if (count($matches) == 2 && count($matches[1]) == 2 &&
$matches[1][0] != $matches[1][1]) {
print('OK');
}
}
?>
--EXPECT--
OK
PK eqY-7c7 7 tests/test_Bug_3513_2.phptnu [ --TEST--
Bug #3513 Support of RFC2231 in header fields. (UTF-8)
--SKIPIF--
--FILE--
addAttachment('testfile',"text/plain", $test, FALSE, 'base64', 'attachment', 'UTF-8', 'de');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match_all('/filename([^\s]+)/i', $content, $matches)) {
echo implode("\n", $matches[1]);
}
--EXPECT--
*0*=UTF-8'de'S%C3%BCper%20gr%C3%B6se%20tolle%20tolle%20gr%C3%BC;
*1*=%C3%9Fe.txt;
PK eqY;{ tests/test_Bug_GH19.phptnu [ --TEST--
Bug GH-19 Test boundary value with different headers()/get() call order
--SKIPIF--
--FILE--
setHTMLBody('html');
$mime->setTXTBody('text');
$body = $mime->get();
$hdrs = $mime->headers(array(
'From' => 'test@domain.tld',
'Subject' => 'Subject',
'To' => 'to@domain.tld'
));
preg_match('/boundary="([^"]+)/', $hdrs['Content-Type'], $matches);
$boundary = $matches[1];
echo substr_count($body, "--$boundary") . "\n";
// Test headers() before get()
$mime = new Mail_mime("\r\n");
$mime->setHTMLBody('html');
$mime->setTXTBody('text');
$hdrs = $mime->headers(array(
'From' => 'test@domain.tld',
'Subject' => 'Subject',
'To' => 'to@domain.tld'
));
$body = $mime->get();
preg_match('/boundary="([^"]+)/', $hdrs['Content-Type'], $matches);
$boundary = $matches[1];
echo substr_count($body, "--$boundary");
--EXPECT--
3
3
PK eqY( ( tests/test_Bug_10596_1.phptnu [ --TEST--
Bug #10596 Incorrect handling of text and html '0' bodies
--SKIPIF--
--FILE--
setTxtBody('0');
$mime->setHTMLBody('0');
$body = $mime->get();
if ($body){
print("OK");
}else{
print("NO BODY FOUND");
}
--EXPECT--
OK
PK eqYa[ tests/class-filename.phptnu [ --TEST--
Test class filename (bug #24)
--SKIPIF--
--FILE--
--EXPECT--
Include OK
PK eqY29r tests/encoding_case.phptnu [ --TEST--
Bug #2364 Tabs in Mail_mimePart::quotedPrintableEncode()
--SKIPIF--
--FILE--
--EXPECT--
Here's=
=09
a tab
PK eqYCz2} } tests/test_Bug_12165.phptnu [ --TEST--
Bug #12165 Dot at the end of the line disappeared
--SKIPIF--
--FILE--
setHTMLBody($string);
print_r($mime->get());
--EXPECT--
http://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=
=2Ecom
PK eqYB& tests/test_Bug_12466.phptnu [ --TEST--
Bug #12466 Content-Transfer-Encoding checking
--SKIPIF--
--FILE--
'7bit',
'html_encoding' => '7bit',
);
$mime = new Mail_mime($params);
$mime->setTXTBody("ż");
$mime->setHTMLBody("z");
$body = $mime->getMessage();
preg_match_all('/Content-Transfer-Encoding: (.*)/', $body, $m);
echo trim($m[1][0])."\n".trim($m[1][1]);
?>
--EXPECT--
quoted-printable
7bit
PK eqY)#p p tests/test_Bug_18772.phptnu [ --TEST--
Bug #18772 Text/calendar message
--SKIPIF--
--FILE--
setSubject('test');
// A message with text/calendar only
$mime->setCalendarBody('VCALENDAR');
echo $mime->getMessage();
echo "\n---\n";
// A message with alternative text
$mime->setTXTBody('vcalendar');
$msg = $mime->getMessage();
echo preg_replace('/=_[0-9a-z]+/', '*', $msg);
--EXPECT--
MIME-Version: 1.0
Subject: test
Content-Type: text/calendar; charset=UTF-8; method=request
Content-Transfer-Encoding: quoted-printable
VCALENDAR
---
MIME-Version: 1.0
Subject: test
Content-Type: multipart/alternative;
boundary="*"
--*
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
vcalendar
--*
Content-Transfer-Encoding: quoted-printable
Content-Type: text/calendar; method=request; charset=UTF-8
VCALENDAR
--*--
PK eqY%+2P P tests/test_Bug_18083.phptnu [ --TEST--
Bug #18083 Separate charset for attachment's content and headers
--SKIPIF--
--FILE--
addAttachment('testfile', "text/plain",
base64_decode("xZtjaWVtYQ=="), FALSE,
'base64', 'attachment', 'ISO-8859-1', 'pl', '',
'quoted-printable', 'base64', '', 'UTF-8');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match_all('/(name|filename)=([^\s]+)/i', $content, $matches)) {
echo implode("\n", $matches[2]);
}
?>
--EXPECT--
"=?UTF-8?Q?=C5=9Bciema?="
"=?UTF-8?B?xZtjaWVtYQ==?=";
PK eqYv tests/test_Bug_8541_1.phptnu [ --TEST--
Bug #8541 mimePart.php line delimiter is \r
--SKIPIF--
--FILE--
--FILE--
'),
array('From', 'adresse@adresse.de'),
array('From', 'Frank Do '),
array('To', 'Frank Do , James Clark '),
array('From', '"Frank Do" '),
array('Cc', '"Frank Do" , "James Clark" '),
array('Cc', ' , "Kuśmiderski Jan Krzysztof Janusz Długa nazwa" '),
array('From', '"adresse@adresse.de" '),
array('From', 'adresse@adresse.de '),
array('From', '"German Umlauts öäü" '),
array('Subject', 'German Umlauts öäü '),
array('Subject', 'Short ASCII subject'),
array('Subject', 'Long ASCII subject - multiline space separated words - too long for one line'),
array('Subject', 'Short Unicode ż subject'),
array('Subject', 'Long Unicode subject - zażółć gęślą jaźń - too long for one line'),
array('References', ' <4b2e87ac$1@news.home.net.pl> '),
array('To', '"Frank Do" ,, "James Clark" '),
array('To', '"Frank \\" \\\\Do" '),
array('To', 'Frank " \\Do '),
array('Subject', "A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test"),
array('Subject', "TEST Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir!!!?"),
array('Subject', "Update: Microsoft Windows-Tool zum Entfernen bösartiger Software 3.6"),
array('From', "test@nàme "),
array('From', "Test <\"test test\"@domain.com>"),
array('From', "\"test test\"@domain.com"),
array('From', "<\"test test\"@domain.com>"),
array('From', "Doe"),
array('From', "\"John Doe\""),
array('Mail-Reply-To', 'adresse@adresse.de '),
array('Mail-Reply-To', '"öäü" '),
array('Subject', mb_convert_encoding('㈱山﨑工業', 'ISO-2022-JP-MS', 'UTF-8'), 'ISO-2022-JP'),
);
$i = 1;
foreach ($headers as $header) {
$charset = isset($header[2]) ? $header[2] : 'UTF-8';
$hdr = $mime->encodeHeader($header[0], $header[1], $charset, 'base64');
printf("[%02d] %s: %s\n", $i, $header[0], $hdr);
$hdr = $mime->encodeHeader($header[0], $header[1], $charset, 'quoted-printable');
printf("[%02d] %s: %s\n", $i, $header[0], $hdr);
$i++;
}
?>
--EXPECT--
[01] From:
[01] From:
[02] From: adresse@adresse.de
[02] From: adresse@adresse.de
[03] From: Frank Do
[03] From: Frank Do
[04] To: Frank Do , James Clark
[04] To: Frank Do , James Clark
[05] From: "Frank Do"
[05] From: "Frank Do"
[06] Cc: "Frank Do" , "James Clark"
[06] Cc: "Frank Do" , "James Clark"
[07] Cc: , =?UTF-8?B?S3XFm21pZGVyc2tpIEphbiBLcnp5c3p0b2Yg?=
=?UTF-8?B?SmFudXN6IETFgnVnYSBuYXp3YQ==?=
[07] Cc: , =?UTF-8?Q?Ku=C5=9Bmiderski_Jan_Krzysztof_Janusz?=
=?UTF-8?Q?_D=C5=82uga_nazwa?=
[08] From: "adresse@adresse.de"
[08] From: "adresse@adresse.de"
[09] From: "adresse@adresse.de"
[09] From: "adresse@adresse.de"
[10] From: =?UTF-8?B?R2VybWFuIFVtbGF1dHMgw7bDpMO8?=
[10] From: =?UTF-8?Q?German_Umlauts_=C3=B6=C3=A4=C3=BC?=
[11] Subject: =?UTF-8?B?R2VybWFuIFVtbGF1dHMgw7bDpMO8IDxhZHJlc3NlQGFkcmVzc2Uu?=
=?UTF-8?B?ZGU+?=
[11] Subject: =?UTF-8?Q?German_Umlauts_=C3=B6=C3=A4=C3=BC_=3Cadresse=40adresse?=
=?UTF-8?Q?=2Ede=3E?=
[12] Subject: Short ASCII subject
[12] Subject: Short ASCII subject
[13] Subject: Long ASCII subject - multiline space separated words - too long for
one line
[13] Subject: Long ASCII subject - multiline space separated words - too long for
one line
[14] Subject: =?UTF-8?B?U2hvcnQgVW5pY29kZSDFvCBzdWJqZWN0?=
[14] Subject: =?UTF-8?Q?Short_Unicode_=C5=BC_subject?=
[15] Subject: =?UTF-8?B?TG9uZyBVbmljb2RlIHN1YmplY3QgLSB6YcW8w7PFgsSHIGfEmcWb?=
=?UTF-8?B?bMSFIGphxbrFhCAtIHRvbyBsb25nIGZvciBvbmUgbGluZQ==?=
[15] Subject: =?UTF-8?Q?Long_Unicode_subject_-_za=C5=BC=C3=B3=C5=82=C4=87_g?=
=?UTF-8?Q?=C4=99=C5=9Bl=C4=85_ja=C5=BA=C5=84_-_too_long_for_one_line?=
[16] References:
<4b2e87ac$1@news.home.net.pl>
[16] References:
<4b2e87ac$1@news.home.net.pl>
[17] To: "Frank Do" , "James Clark"
[17] To: "Frank Do" , "James Clark"
[18] To: "Frank \" \\Do"
[18] To: "Frank \" \\Do"
[19] To: "Frank \" \\Do"
[19] To: "Frank \" \\Do"
[20] Subject: A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test
[20] Subject: A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test
[21] Subject: =?UTF-8?B?VEVTVCBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1p?=
=?UTF-8?B?ciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIg?=
=?UTF-8?B?Z3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRv?=
=?UTF-8?B?bGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7w=?=
=?UTF-8?B?w59lIHZvbiBtaXIgU8O8cGVyIGdyw7ZzZSB0b2xsZSBncsO8w59lIHZvbiBt?=
=?UTF-8?B?aXIgU8O8cGVyIGdyw7ZzZSB0b2xsZSBncsO8w59lIHZvbiBtaXIgU8O8cGVy?=
=?UTF-8?B?IGdyw7ZzZSB0b2xsZSBncsO8w59lIHZvbiBtaXIgU8O8cGVyIGdyw7ZzZSB0?=
=?UTF-8?B?b2xsZSBncsO8w59lIHZvbiBtaXIhISE/?=
[21] Subject: =?UTF-8?Q?TEST_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_m?=
=?UTF-8?Q?ir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCp?=
=?UTF-8?Q?er_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6?=
=?UTF-8?Q?se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tolle_gr?=
=?UTF-8?Q?=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC?=
=?UTF-8?Q?=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von?=
=?UTF-8?Q?_mir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S?=
=?UTF-8?Q?=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir!!!=3F?=
[22] Subject: =?UTF-8?B?VXBkYXRlOiBNaWNyb3NvZnQgV2luZG93cy1Ub29sIHp1bSBFbnRm?=
=?UTF-8?B?ZXJuZW4gYsO2c2FydGlnZXIgU29mdHdhcmUgMy42?=
[22] Subject: =?UTF-8?Q?Update=3A_Microsoft_Windows-Tool_zum_Entfernen_b=C3=B6?=
=?UTF-8?Q?sartiger_Software_3=2E6?=
[23] From: =?UTF-8?B?dGVzdEBuw6BtZQ==?=
[23] From: =?UTF-8?Q?test=40n=C3=A0me?=
[24] From: Test <"test test"@domain.com>
[24] From: Test <"test test"@domain.com>
[25] From: "test test"@domain.com
[25] From: "test test"@domain.com
[26] From: <"test test"@domain.com>
[26] From: <"test test"@domain.com>
[27] From: Doe
[27] From: Doe
[28] From: "John Doe"
[28] From: "John Doe"
[29] Mail-Reply-To: "adresse@adresse.de"
[29] Mail-Reply-To: "adresse@adresse.de"
[30] Mail-Reply-To: =?UTF-8?B?w7bDpMO8?=
[30] Mail-Reply-To: =?UTF-8?Q?=C3=B6=C3=A4=C3=BC?=
[31] Subject: =?ISO-2022-JP?B?GyRCLWo7M3l1OSk2SBsoQg==?=
[31] Subject: =?ISO-2022-JP?Q?=24B-j=28B=24B=3B3=28B=24Byu=28B?=
=?ISO-2022-JP?Q?=24B9=29=28B=24B6H=28B?=
PK eqYk0 tests/test_Bug_20564.phptnu [ --TEST--
Bug #20564 Unsetting headers
--SKIPIF--
--FILE--
setSubject('test');
$headers = $mime->headers(array('Subject' => null), true);
echo array_key_exists('Subject', $headers) ? '1' : '0';
--EXPECT--
0PK eqY5 tests/test_Bug_21098.phptnu [ --TEST--
Bug #21098 Handling of empty plain text parts
--SKIPIF--
--FILE--
setTxtBody('');
$mime->setHTMLBody('');
$headers1 = $mime->txtHeaders();
$body = $mime->get();
$headers2 = $mime->txtHeaders();
print strpos($headers1, 'text/html') && strpos($headers2, 'text/html') ? 'OK' : 'NOT OK';
--EXPECT--
OK
PK eqY8 tests/test_Bug_3513_1.phptnu [ --TEST--
Bug #3513 Support of RFC2231 in header fields. (ISO-8859-1)
--SKIPIF--
--FILE--
addAttachment('testfile',"text/plain", $test, FALSE, 'base64', 'attachment', 'ISO-8859-1');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match('/filename([^\s]+)/i', $content, $matches)) {
echo $matches[1];
}
--EXPECT--
*=ISO-8859-1''F%F3%F3b%E6r.txt;
PK eqYX# # tests/test_Bug_19497.phptnu [ --TEST--
Bug #19497 Attachment filenames with a slash character
--SKIPIF--
--FILE--
addAttachment('testfile', "text/plain", $filename, FALSE,
'base64', 'attachment', 'ISO-8859-1', '', '', 'quoted-printable', 'base64');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match_all('/(name|filename)=([^\s]+)/i', $content, $matches)) {
echo implode("\n", $matches[2]);
}
?>
--EXPECT--
"test/file.txt"
"test/file.txt";
PK eqY@/N N tests/test_Bug_21206.phptnu [ --TEST--
Bug #21206 Handling quoted strings
--SKIPIF--
--FILE--
, b ',
'"c\\\\" , d ',
);
foreach ($tests as $test) {
$addrs = X::explodeQuotedString('[\t,]', $test);
foreach ($addrs as $addr) {
print trim($addr) . PHP_EOL;
}
}
?>
--EXPECT--
"a"
b
"c\\"
d
PK eqYg+ tests/test_Bug_13444.phptnu [ --TEST--
Bug #9725 multipart/related & alternative wrong order
--SKIPIF--
--FILE--
setTXTBody("test");
$mime->setHTMLBody("test");
$mime->addHTMLImage("test", 'application/octet-stream', '', false);
$body = $mime->get();
$head = $mime->headers();
$headCT = $head['Content-Type'];
$headCT = explode(";", $headCT);
$headCT = $headCT[0];
$ct = preg_match_all('|Content-Type: ([^;\r\n]+)|', $body, $matches);
print($headCT);
print("\n");
foreach ($matches[1] as $match){
print($match);
print("\n");
}
--EXPECT--
multipart/alternative
text/plain
multipart/related
text/html
application/octet-stream
PK eqY|J J ) tests/sleep_wakeup_EOL-bug3488-part2.phptnu [ --TEST--
Bug #3488 Sleep/Wakeup EOL Consistency - Part 2
--SKIPIF--
if (!is_readable('sleep_wakeup_data')) {
echo "skip No data. Part 1 must run first.\n";
}
--FILE--
get();
$x = $mmData['mm']->headers();
list($h1) = explode("\n", $mmData['header']);
list($h2) = explode("\n", $x['Content-Type']);
echo ($h1 == $h2) ? "Match" : "No Match";
?>
--EXPECT--
Match
PK eqYMU. . tests/test_Bug_20273.phptnu [ --TEST--
Bug #20273 Mail_mimePart::encodeHeader() and TAB character
--SKIPIF--
--FILE--
\t";
$mime = new Mail_mimePart();
echo $mime->encodeHeader('References', $refs);
?>
--EXPECT--
PK eqY2!B tests/test_linebreak_dot.phptnu [ --TEST--
Test for correct "." encoding when doing linebreaks
--SKIPIF--
--FILE--
'text/plain',
'encoding' => 'quoted-printable',
);
for ($i=74; $i <= strlen($text); $i++) {
$input = substr($text, 0, $i);
$mimePart = new Mail_mimePart($input, $params);
$encoded = $mimePart->encode();
$output = $encoded['body'];
printf("input: %02d: %s\n", strlen($input), $input);
$lines = explode("\r\n", $output);
for($j=0; $j < count($lines); $j++) {
$line = $lines[$j];
if ($j + 1 < count($lines)) {
$line_vis = $line.'\r\n';
} else {
$line_vis = $line;
}
printf("output:%02d: %s\n", strlen($line), $line_vis);
}
print("---\n");
}
--EXPECT--
input: 74: 0123456789012345678901234567890123456789012345678901234567890123456789012.
output:74: 0123456789012345678901234567890123456789012345678901234567890123456789012.
---
input: 75: 0123456789012345678901234567890123456789012345678901234567890123456789012..
output:75: 0123456789012345678901234567890123456789012345678901234567890123456789012..
---
input: 76: 0123456789012345678901234567890123456789012345678901234567890123456789012...
output:76: 0123456789012345678901234567890123456789012345678901234567890123456789012...
---
input: 77: 0123456789012345678901234567890123456789012345678901234567890123456789012...6
output:76: 0123456789012345678901234567890123456789012345678901234567890123456789012..=\r\n
output:04: =2E6
---
PK eqYXb tests/test_Bug_14779.phptnu [ --TEST--
Bug #14779 Proper header-body separator for empty attachment
--SKIPIF--
--FILE--
addAttachment('', "text/plain", 'file.txt', FALSE, 'base64', 'attachment');
$result = $m->get();
if (preg_match('/(Content.*)--=.*/s', $result, $matches)) {
print_r($matches[1]."END");
}
?>
--EXPECT--
Content-Transfer-Encoding: base64
Content-Type: text/plain;
name=file.txt
Content-Disposition: attachment;
filename=file.txt
END
PK eqY`~@ tests/test_Bug_12385_1.phptnu [ --TEST--
Bug #12385 Bad regex when replacing css style attachments
--SKIPIF--
--FILE--
className {
background-image: url('test.gif');
}
";
$mime->setHTMLBody($body);
$mime->setFrom($from);
$mime->addHTMLImage('','image/gif', 'test.gif', false);
$msg = $mime->get();
$cidtag = preg_match("|url\('cid:[^']*'\);|", $msg);
if (!$cidtag){
print("FAIL:\n");
print($msg);
}else{
print("OK");
}
--EXPECT--
OK
PK eqY
Ǟ # tests/test_linebreak_larger_76.phptnu [ --TEST--
Test for correct linebreaks for lines _longer_ than 76 chars.
--SKIPIF--
--FILE--
'text/plain',
'encoding' => 'quoted-printable',
);
for ($i=74; $i <= strlen($text); $i++) {
$input = substr($text, 0, $i);
$mimePart = new Mail_mimePart($input, $params);
$encoded = $mimePart->encode();
$output = $encoded['body'];
printf("input: %02d: %s\n", strlen($input), $input);
$lines = explode("\r\n", $output);
for($j=0; $j < count($lines); $j++) {
$line = $lines[$j];
if ($j + 1 < count($lines)) {
$line_vis = $line.'\r\n';
} else {
$line_vis = $line;
}
printf("output:%02d: %s\n", strlen($line), $line_vis);
}
print("---\n");
}
--EXPECT--
input: 74: 12345678901234567890123456789012345678901234567890123456789012345678901234
output:74: 12345678901234567890123456789012345678901234567890123456789012345678901234
---
input: 75: 123456789012345678901234567890123456789012345678901234567890123456789012345
output:75: 123456789012345678901234567890123456789012345678901234567890123456789012345
---
input: 76: 1234567890123456789012345678901234567890123456789012345678901234567890123456
output:76: 1234567890123456789012345678901234567890123456789012345678901234567890123456
---
input: 77: 12345678901234567890123456789012345678901234567890123456789012345678901234567
output:76: 123456789012345678901234567890123456789012345678901234567890123456789012345=\r\n
output:02: 67
---
input: 78: 123456789012345678901234567890123456789012345678901234567890123456789012345678
output:76: 123456789012345678901234567890123456789012345678901234567890123456789012345=\r\n
output:03: 678
---
input: 79: 1234567890123456789012345678901234567890123456789012345678901234567890123456789
output:76: 123456789012345678901234567890123456789012345678901234567890123456789012345=\r\n
output:04: 6789
---
input: 80: 12345678901234567890123456789012345678901234567890123456789012345678901234567890
output:76: 123456789012345678901234567890123456789012345678901234567890123456789012345=\r\n
output:05: 67890
---
PK eqYԢ` ` tests/test_Bug_21255.phptnu [ --TEST--
Bug #21255 Boundary gets added twice
--SKIPIF--
--FILE--
setHTMLBody('html');
$mime->setTXTBody('text');
$mime->setContentType('multipart/alternative', array('boundary' => 'something'));
$msg = $mime->getMessage();
echo substr_count($msg, 'boundary=');
?>
--EXPECT--
1
PK eqYUiE! E! # tests/headers_without_mbstring.phptnu [ --TEST--
Multi-test for headers encoding using base64 and quoted-printable
--SKIPIF--
--FILE--
'),
array('From', 'adresse@adresse.de'),
array('From', 'Frank Do '),
array('To', 'Frank Do , James Clark '),
array('From', '"Frank Do" '),
array('Cc', '"Frank Do" , "James Clark" '),
array('Cc', ' , "Kuśmiderski Jan Krzysztof Janusz Długa nazwa" '),
array('From', '"adresse@adresse.de" '),
array('From', 'adresse@adresse.de '),
array('From', '"German Umlauts öäü" '),
array('Subject', 'German Umlauts öäü '),
array('Subject', 'Short ASCII subject'),
array('Subject', 'Long ASCII subject - multiline space separated words - too long for one line'),
array('Subject', 'Short Unicode ż subject'),
array('Subject', 'Long Unicode subject - zażółć gęślą jaźń - too long for one line'),
array('References', ' <4b2e87ac$1@news.home.net.pl> '),
array('To', '"Frank Do" ,, "James Clark" '),
array('To', '"Frank \\" \\\\Do" '),
array('To', 'Frank " \\Do '),
array('Subject', "A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test"),
array('Subject', "TEST Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir Süper gröse tolle grüße von mir!!!?"),
array('Subject', "Update: Microsoft Windows-Tool zum Entfernen bösartiger Software 3.6"),
array('From', "test@nàme "),
array('From', "Test <\"test test\"@domain.com>"),
array('From', "\"test test\"@domain.com"),
array('From', "<\"test test\"@domain.com>"),
array('From', "Doe"),
array('From', "\"John Doe\""),
array('Mail-Reply-To', 'adresse@adresse.de '),
array('Mail-Reply-To', '"öäü" '),
);
$i = 1;
foreach ($headers as $header) {
$hdr = $mime->encodeHeader($header[0], $header[1], 'UTF-8', 'base64');
printf("[%02d] %s: %s\n", $i, $header[0], $hdr);
$hdr = $mime->encodeHeader($header[0], $header[1], 'UTF-8', 'quoted-printable');
printf("[%02d] %s: %s\n", $i, $header[0], $hdr);
$i++;
}
?>
--EXPECT--
[01] From:
[01] From:
[02] From: adresse@adresse.de
[02] From: adresse@adresse.de
[03] From: Frank Do
[03] From: Frank Do
[04] To: Frank Do , James Clark
[04] To: Frank Do , James Clark
[05] From: "Frank Do"
[05] From: "Frank Do"
[06] Cc: "Frank Do" , "James Clark"
[06] Cc: "Frank Do" , "James Clark"
[07] Cc: , =?UTF-8?B?S3XFm21pZGVyc2tpIEphbiBLcnp5c3p0b2Yg?=
=?UTF-8?B?SmFudXN6IETFgnVnYSBuYXp3YQ==?=
[07] Cc: ,
=?UTF-8?Q?Ku=C5=9Bmiderski_Jan_Krzysztof_Janusz_D?=
=?UTF-8?Q?=C5=82uga_nazwa?=
[08] From: "adresse@adresse.de"
[08] From: "adresse@adresse.de"
[09] From: "adresse@adresse.de"
[09] From: "adresse@adresse.de"
[10] From: =?UTF-8?B?R2VybWFuIFVtbGF1dHMgw7bDpMO8?=
[10] From: =?UTF-8?Q?German_Umlauts_=C3=B6=C3=A4=C3=BC?=
[11] Subject: =?UTF-8?B?R2VybWFuIFVtbGF1dHMgw7bDpMO8IDxhZHJlc3NlQGFkcmVzc2Uu?=
=?UTF-8?B?ZGU+?=
[11] Subject: =?UTF-8?Q?German_Umlauts_=C3=B6=C3=A4=C3=BC_=3Cadresse=40adresse?=
=?UTF-8?Q?=2Ede=3E?=
[12] Subject: Short ASCII subject
[12] Subject: Short ASCII subject
[13] Subject: Long ASCII subject - multiline space separated words - too long for
one line
[13] Subject: Long ASCII subject - multiline space separated words - too long for
one line
[14] Subject: =?UTF-8?B?U2hvcnQgVW5pY29kZSDFvCBzdWJqZWN0?=
[14] Subject: =?UTF-8?Q?Short_Unicode_=C5=BC_subject?=
[15] Subject: =?UTF-8?B?TG9uZyBVbmljb2RlIHN1YmplY3QgLSB6YcW8w7PFgsSHIGfEmcWb?=
=?UTF-8?B?bMSFIGphxbrFhCAtIHRvbyBsb25nIGZvciBvbmUgbGluZQ==?=
[15] Subject: =?UTF-8?Q?Long_Unicode_subject_-_za=C5=BC=C3=B3=C5=82=C4=87_g=C4?=
=?UTF-8?Q?=99=C5=9Bl=C4=85_ja=C5=BA=C5=84_-_too_long_for_one_line?=
[16] References:
<4b2e87ac$1@news.home.net.pl>
[16] References:
<4b2e87ac$1@news.home.net.pl>
[17] To: "Frank Do" , "James Clark"
[17] To: "Frank Do" , "James Clark"
[18] To: "Frank \" \\Do"
[18] To: "Frank \" \\Do"
[19] To: "Frank \" \\Do"
[19] To: "Frank \" \\Do"
[20] Subject: A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test
[20] Subject: A REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY
REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY /REALLY/ LONG test
[21] Subject: =?UTF-8?B?VEVTVCBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1p?=
=?UTF-8?B?ciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIg?=
=?UTF-8?B?Z3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRv?=
=?UTF-8?B?bGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zD?=
=?UTF-8?B?n2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1p?=
=?UTF-8?B?ciBTw7xwZXIgZ3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIg?=
=?UTF-8?B?Z3LDtnNlIHRvbGxlIGdyw7zDn2Ugdm9uIG1pciBTw7xwZXIgZ3LDtnNlIHRv?=
=?UTF-8?B?bGxlIGdyw7zDn2Ugdm9uIG1pciEhIT8=?=
[21] Subject: =?UTF-8?Q?TEST_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir?=
=?UTF-8?Q?_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_g?=
=?UTF-8?Q?r=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tol?=
=?UTF-8?Q?le_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC?=
=?UTF-8?Q?=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_m?=
=?UTF-8?Q?ir_S=C3=BCper_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper?=
=?UTF-8?Q?_gr=C3=B6se_tolle_gr=C3=BC=C3=9Fe_von_mir_S=C3=BCper_gr=C3=B6se_t?=
=?UTF-8?Q?olle_gr=C3=BC=C3=9Fe_von_mir!!!=3F?=
[22] Subject: =?UTF-8?B?VXBkYXRlOiBNaWNyb3NvZnQgV2luZG93cy1Ub29sIHp1bSBFbnRm?=
=?UTF-8?B?ZXJuZW4gYsO2c2FydGlnZXIgU29mdHdhcmUgMy42?=
[22] Subject: =?UTF-8?Q?Update=3A_Microsoft_Windows-Tool_zum_Entfernen_b=C3=B6sa?=
=?UTF-8?Q?rtiger_Software_3=2E6?=
[23] From: =?UTF-8?B?dGVzdEBuw6BtZQ==?=
[23] From: =?UTF-8?Q?test=40n=C3=A0me?=
[24] From: Test <"test test"@domain.com>
[24] From: Test <"test test"@domain.com>
[25] From: "test test"@domain.com
[25] From: "test test"@domain.com
[26] From: <"test test"@domain.com>
[26] From: <"test test"@domain.com>
[27] From: Doe
[27] From: Doe
[28] From: "John Doe"
[28] From: "John Doe"
[29] Mail-Reply-To: "adresse@adresse.de"
[29] Mail-Reply-To: "adresse@adresse.de"
[30] Mail-Reply-To: =?UTF-8?B?w7bDpMO8?=
[30] Mail-Reply-To: =?UTF-8?Q?=C3=B6=C3=A4=C3=BC?=
PK eqY(V, tests/test_Bug_12411.phptnu [ --TEST--
Bug #12411 RFC2047 encoded attachment filenames
--SKIPIF--
--FILE--
addAttachment('testfile', "text/plain", $filename, FALSE,
'base64', 'attachment', 'ISO-8859-1', 'pl', '',
'quoted-printable', 'base64');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match_all('/(name|filename)=([^\s]+)/i', $content, $matches)) {
echo implode("\n", $matches[2]);
}
?>
--EXPECT--
"=?ISO-8859-1?Q?=C5=9Bciema?="
"=?ISO-8859-1?B?xZtjaWVtYQ==?=";
PK eqY1d tests/test_Bug_17025.phptnu [ --TEST--
Bug #16539 Headers longer than 998 characters
--SKIPIF--
--FILE--
headers($headers);
print_r($hdrs['From']);
?>
--EXPECT--
aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhhh
PK eqYe@Q_ _ tests/test_Bug_14780.phptnu [ --TEST--
Bug #14780 Invalid Content-Type when headers() is called before get()
--SKIPIF--
--FILE--
setTXTBody("test");
$mime->setHTMLBody("test");
$head1 = $mime->headers();
$body = $mime->get();
$head2 = $mime->headers();
if ($head1 === $head2) {
echo "OK";
}
?>
--EXPECT--
OK
PK eqYZXHw w tests/test_Bug_3513_3.phptnu [ --TEST--
Bug #3513 Support of RFC2231 in header fields. (ISO-2022-JP)
--SKIPIF--
--FILE--
addAttachment('testfile',"text/plain", $test, FALSE, 'base64', 'attachment', 'iso-2022-jp', '');
$content = $Mime->get();
$content = str_replace("\n", '', $content);
if (preg_match('/filename([^\s]+)/i', $content, $matches)) {
echo $matches[1];
}
?>
--EXPECT--
*=iso-2022-jp''%1B$BF|K%5C8l%1B%28B.txt;
PK eqY tests/test_Bug_15320.phptnu [ PK eqY tests/test_Bug_21027.phptnu [ PK eqYi; tests/test_Bug_7561_1.phptnu [ PK eqYqS ! tests/test_Bug_10999_1.phptnu [ PK eqYQi"- - # tests/test_Bug_11381.phptnu [ PK eqY'' ' Z&