Migrated away from PHP Mail Parser to the new WebKlex PHP IMAP Mail Parser this will open the way to support OAUTH2 for Mail servers such as Microsoft 365 and Google Workspaces

This commit is contained in:
johnnyq
2024-06-12 15:39:52 -04:00
parent d64a7ce31e
commit 779527cf6a
218 changed files with 14781 additions and 2722 deletions

View File

@@ -0,0 +1,72 @@
<?php
/*
* File: AddressTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 28.12.22 18:11
* Updated: -
*
* Description:
* -
*/
namespace Tests;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Address;
class AddressTest extends TestCase {
/**
* Test data
*
* @var array|string[] $data
*/
protected array $data = [
"personal" => "Username",
"mailbox" => "info",
"host" => "domain.tld",
"mail" => "info@domain.tld",
"full" => "Username <info@domain.tld>",
];
/**
* Address test
*
* @return void
*/
public function testAddress(): void {
$address = new Address((object)$this->data);
self::assertSame("Username", $address->personal);
self::assertSame("info", $address->mailbox);
self::assertSame("domain.tld", $address->host);
self::assertSame("info@domain.tld", $address->mail);
self::assertSame("Username <info@domain.tld>", $address->full);
}
/**
* Test Address to string conversion
*
* @return void
*/
public function testAddressToStringConversion(): void {
$address = new Address((object)$this->data);
self::assertSame("Username <info@domain.tld>", (string)$address);
}
/**
* Test Address serialization
*
* @return void
*/
public function testAddressSerialization(): void {
$address = new Address((object)$this->data);
foreach($address as $key => $value) {
self::assertSame($this->data[$key], $value);
}
}
}

View File

@@ -0,0 +1,75 @@
<?php
/*
* File: AttributeTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 28.12.22 18:11
* Updated: -
*
* Description:
* -
*/
namespace Tests;
use Carbon\Carbon;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Attribute;
class AttributeTest extends TestCase {
/**
* String Attribute test
*
* @return void
*/
public function testStringAttribute(): void {
$attribute = new Attribute("foo", "bar");
self::assertSame("bar", $attribute->toString());
self::assertSame("foo", $attribute->getName());
self::assertSame("foos", $attribute->setName("foos")->getName());
}
/**
* Date Attribute test
*
* @return void
*/
public function testDateAttribute(): void {
$attribute = new Attribute("foo", "2022-12-26 08:07:14 GMT-0800");
self::assertInstanceOf(Carbon::class, $attribute->toDate());
self::assertSame("2022-12-26 08:07:14 GMT-0800", $attribute->toDate()->format("Y-m-d H:i:s T"));
}
/**
* Array Attribute test
*
* @return void
*/
public function testArrayAttribute(): void {
$attribute = new Attribute("foo", ["bar"]);
self::assertSame("bar", $attribute->toString());
$attribute->add("bars");
self::assertSame(true, $attribute->has(1));
self::assertSame("bars", $attribute->get(1));
self::assertSame(true, $attribute->contains("bars"));
self::assertSame("foo, bars", $attribute->set("foo", 0)->toString());
$attribute->remove(0);
self::assertSame("bars", $attribute->toString());
self::assertSame("bars, foos", $attribute->merge(["foos", "bars"], true)->toString());
self::assertSame("bars, foos, foos, donk", $attribute->merge(["foos", "donk"], false)->toString());
self::assertSame(4, $attribute->count());
self::assertSame("donk", $attribute->last());
self::assertSame("bars", $attribute->first());
self::assertSame(["bars", "foos", "foos", "donk"], array_values($attribute->all()));
}
}

View File

@@ -0,0 +1,94 @@
<?php
/*
* File: ClientManagerTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 28.12.22 18:11
* Updated: -
*
* Description:
* -
*/
namespace Tests;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Client;
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\IMAP;
class ClientManagerTest extends TestCase {
/** @var ClientManager $cm */
protected ClientManager $cm;
/**
* Setup the test environment.
*
* @return void
*/
public function setUp(): void {
$this->cm = new ClientManager();
}
/**
* Test if the config can be accessed
*
* @return void
*/
public function testConfigAccessorAccount(): void {
$config = $this->cm->getConfig();
self::assertInstanceOf(Config::class, $config);
self::assertSame("default", $config->get("default"));
self::assertSame("d-M-Y", $config->get("date_format"));
self::assertSame(IMAP::FT_PEEK, $config->get("options.fetch"));
self::assertSame([], $config->get("options.open"));
}
/**
* Test creating a client instance
*
* @throws MaskNotFoundException
*/
public function testMakeClient(): void {
self::assertInstanceOf(Client::class, $this->cm->make([]));
}
/**
* Test accessing accounts
*
* @throws MaskNotFoundException
*/
public function testAccountAccessor(): void {
self::assertSame("default", $this->cm->getConfig()->getDefaultAccount());
self::assertNotEmpty($this->cm->account("default"));
$this->cm->getConfig()->setDefaultAccount("foo");
self::assertSame("foo", $this->cm->getConfig()->getDefaultAccount());
$this->cm->getConfig()->setDefaultAccount("default");
}
/**
* Test setting a config
*
* @throws MaskNotFoundException
*/
public function testSetConfig(): void {
$config = [
"default" => "foo",
"options" => [
"fetch" => IMAP::ST_MSGN,
"open" => "foo"
]
];
$cm = new ClientManager($config);
self::assertSame("foo", $cm->getConfig()->getDefaultAccount());
self::assertInstanceOf(Client::class, $cm->account("foo"));
self::assertSame(IMAP::ST_MSGN, $cm->getConfig()->get("options.fetch"));
self::assertSame(false, is_array($cm->getConfig()->get("options.open")));
}
}

View File

@@ -0,0 +1,314 @@
<?php
/*
* File: ClientTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 28.12.22 18:11
* Updated: -
*
* Description:
* -
*/
namespace Tests;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Client;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Connection\Protocols\ImapProtocol;
use Webklex\PHPIMAP\Connection\Protocols\Response;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
use Webklex\PHPIMAP\Folder;
use Webklex\PHPIMAP\Support\Masks\AttachmentMask;
use Webklex\PHPIMAP\Support\Masks\MessageMask;
class ClientTest extends TestCase {
/** @var Client $client */
protected Client $client;
/** @var MockObject ImapProtocol mockup */
protected MockObject $protocol;
/**
* Setup the test environment.
*
* @return void
* @throws MaskNotFoundException
*/
public function setUp(): void {
$config = Config::make([
"accounts" => [
"default" => [
'protocol' => 'imap',
'encryption' => 'ssl',
'username' => 'foo@domain.tld',
'password' => 'bar',
'proxy' => [
'socket' => null,
'request_fulluri' => false,
'username' => null,
'password' => null,
],
]]
]);
$this->client = new Client($config);
}
/**
* Client test
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws RuntimeException
*/
public function testClient(): void {
$this->createNewProtocolMockup();
self::assertInstanceOf(ImapProtocol::class, $this->client->getConnection());
self::assertSame(true, $this->client->isConnected());
self::assertSame(false, $this->client->checkConnection());
self::assertSame(30, $this->client->getTimeout());
self::assertSame(MessageMask::class, $this->client->getDefaultMessageMask());
self::assertSame(AttachmentMask::class, $this->client->getDefaultAttachmentMask());
self::assertArrayHasKey("new", $this->client->getDefaultEvents("message"));
}
public function testClientLogout(): void {
$this->createNewProtocolMockup();
$this->protocol->expects($this->any())->method('logout')->willReturn(Response::empty()->setResponse([
0 => "BYE Logging out\r\n",
1 => "OK Logout completed (0.001 + 0.000 secs).\r\n",
]));
self::assertInstanceOf(Client::class, $this->client->disconnect());
}
public function testClientExpunge(): void {
$this->createNewProtocolMockup();
$this->protocol->expects($this->any())->method('expunge')->willReturn(Response::empty()->setResponse([
0 => "OK",
1 => "Expunge",
2 => "completed",
3 => [
0 => "0.001",
1 => "+",
2 => "0.000",
3 => "secs).",
],
]));
self::assertNotEmpty($this->client->expunge());
}
public function testClientFolders(): void {
$this->createNewProtocolMockup();
$this->protocol->expects($this->any())->method('expunge')->willReturn(Response::empty()->setResponse([
0 => "OK",
1 => "Expunge",
2 => "completed",
3 => [
0 => "0.001",
1 => "+",
2 => "0.000",
3 => "secs).",
],
]));
$this->protocol->expects($this->any())->method('selectFolder')->willReturn(Response::empty()->setResponse([
"flags" => [
0 => [
0 => "\Answered",
1 => "\Flagged",
2 => "\Deleted",
3 => "\Seen",
4 => "\Draft",
5 => "NonJunk",
6 => "unknown-1",
],
],
"exists" => 139,
"recent" => 0,
"unseen" => 94,
"uidvalidity" => 1488899637,
"uidnext" => 278,
]));
self::assertNotEmpty($this->client->openFolder("INBOX"));
self::assertSame("INBOX", $this->client->getFolderPath());
$this->protocol->expects($this->any())->method('examineFolder')->willReturn(Response::empty()->setResponse([
"flags" => [
0 => [
0 => "\Answered",
1 => "\Flagged",
2 => "\Deleted",
3 => "\Seen",
4 => "\Draft",
5 => "NonJunk",
6 => "unknown-1",
],
],
"exists" => 139,
"recent" => 0,
"unseen" => 94,
"uidvalidity" => 1488899637,
"uidnext" => 278,
]));
self::assertNotEmpty($this->client->checkFolder("INBOX"));
$this->protocol->expects($this->any())->method('folders')->with($this->identicalTo(""), $this->identicalTo("*"))->willReturn(Response::empty()->setResponse([
"INBOX" => [
"delimiter" => ".",
"flags" => [
0 => "\HasChildren",
],
],
"INBOX.new" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
],
],
"INBOX.9AL56dEMTTgUKOAz" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
],
],
"INBOX.U9PsHCvXxAffYvie" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
],
],
"INBOX.Trash" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
1 => "\Trash",
],
],
"INBOX.processing" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
],
],
"INBOX.Sent" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
1 => "\Sent",
],
],
"INBOX.OzDWCXKV3t241koc" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
],
],
"INBOX.5F3bIVTtBcJEqIVe" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
],
],
"INBOX.8J3rll6eOBWnTxIU" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
],
],
"INBOX.Junk" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
1 => "\Junk",
],
],
"INBOX.Drafts" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
1 => "\Drafts",
],
],
"INBOX.test" => [
"delimiter" => ".",
"flags" => [
0 => "\HasNoChildren",
],
],
]));
$this->protocol->expects($this->any())->method('createFolder')->willReturn(Response::empty()->setResponse([
0 => "OK Create completed (0.004 + 0.000 + 0.003 secs).\r\n",
]));
self::assertNotEmpty($this->client->createFolder("INBOX.new"));
$this->protocol->expects($this->any())->method('deleteFolder')->willReturn(Response::empty()->setResponse([
0 => "OK Delete completed (0.007 + 0.000 + 0.006 secs).\r\n",
]));
self::assertNotEmpty($this->client->deleteFolder("INBOX.new"));
self::assertInstanceOf(Folder::class, $this->client->getFolderByPath("INBOX.new"));
self::assertInstanceOf(Folder::class, $this->client->getFolderByName("new"));
self::assertInstanceOf(Folder::class, $this->client->getFolder("INBOX.new", "."));
self::assertInstanceOf(Folder::class, $this->client->getFolder("new"));
}
public function testClientId(): void {
$this->createNewProtocolMockup();
$this->protocol->expects($this->any())->method('ID')->willReturn(Response::empty()->setResponse([
0 => "ID (\"name\" \"Dovecot\")\r\n",
1 => "OK ID completed (0.001 + 0.000 secs).\r\n"
]));
self::assertSame("ID (\"name\" \"Dovecot\")\r\n", $this->client->Id()[0]);
}
public function testClientConfig(): void {
$config = $this->client->getConfig()->get("accounts.".$this->client->getConfig()->getDefaultAccount());
self::assertSame("foo@domain.tld", $config["username"]);
self::assertSame("bar", $config["password"]);
self::assertSame("localhost", $config["host"]);
self::assertSame(true, $config["validate_cert"]);
self::assertSame(993, $config["port"]);
$this->client->getConfig()->set("accounts.".$this->client->getConfig()->getDefaultAccount(), [
"host" => "domain.tld",
'password' => 'bar',
]);
$config = $this->client->getConfig()->get("accounts.".$this->client->getConfig()->getDefaultAccount());
self::assertSame("bar", $config["password"]);
self::assertSame("domain.tld", $config["host"]);
self::assertSame(true, $config["validate_cert"]);
}
protected function createNewProtocolMockup() {
$this->protocol = $this->createMock(ImapProtocol::class);
$this->protocol->expects($this->any())->method('connected')->willReturn(true);
$this->protocol->expects($this->any())->method('getConnectionTimeout')->willReturn(30);
$this->protocol
->expects($this->any())
->method('createStream')
//->will($this->onConsecutiveCalls(true));
->willReturn(true);
$this->client->connection = $this->protocol;
}
}

View File

@@ -0,0 +1,155 @@
<?php
/*
* File: HeaderTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 28.12.22 18:11
* Updated: -
*
* Description:
* -
*/
namespace Tests;
use Carbon\Carbon;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Address;
use Webklex\PHPIMAP\Attribute;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
use Webklex\PHPIMAP\Header;
use Webklex\PHPIMAP\IMAP;
class HeaderTest extends TestCase {
/** @var Config $config */
protected Config $config;
/**
* Setup the test environment.
*
* @return void
*/
public function setUp(): void {
$this->config = Config::make();
}
/**
* Test parsing email headers
*
* @throws InvalidMessageDateException
*/
public function testHeaderParsing(): void {
$email = file_get_contents(implode(DIRECTORY_SEPARATOR, [__DIR__, "messages", "1366671050@github.com.eml"]));
if (!str_contains($email, "\r\n")) {
$email = str_replace("\n", "\r\n", $email);
}
$raw_header = substr($email, 0, strpos($email, "\r\n\r\n"));
$header = new Header($raw_header, $this->config);
$subject = $header->get("subject");
$returnPath = $header->get("Return-Path");
/** @var Carbon $date */
$date = $header->get("date")->first();
/** @var Address $from */
$from = $header->get("from")->first();
/** @var Address $to */
$to = $header->get("to")->first();
self::assertSame($raw_header, $header->raw);
self::assertInstanceOf(Attribute::class, $subject);
self::assertSame("Re: [Webklex/php-imap] Read all folders? (Issue #349)", $subject->toString());
self::assertSame("Re: [Webklex/php-imap] Read all folders? (Issue #349)", (string)$header->subject);
self::assertSame("<noreply@github.com>", $returnPath->toString());
self::assertSame("return_path", $returnPath->getName());
self::assertSame("-4.299", (string)$header->get("X-Spam-Score"));
self::assertSame("Webklex/php-imap/issues/349/1365266070@github.com", (string)$header->get("Message-ID"));
self::assertSame(6, $header->get("received")->count());
self::assertSame(IMAP::MESSAGE_PRIORITY_UNKNOWN, (int)$header->get("priority")());
self::assertSame("Username", $from->personal);
self::assertSame("notifications", $from->mailbox);
self::assertSame("github.com", $from->host);
self::assertSame("notifications@github.com", $from->mail);
self::assertSame("Username <notifications@github.com>", $from->full);
self::assertSame("Webklex/php-imap", $to->personal);
self::assertSame("php-imap", $to->mailbox);
self::assertSame("noreply.github.com", $to->host);
self::assertSame("php-imap@noreply.github.com", $to->mail);
self::assertSame("Webklex/php-imap <php-imap@noreply.github.com>", $to->full);
self::assertInstanceOf(Carbon::class, $date);
self::assertSame("2022-12-26 08:07:14 GMT-0800", $date->format("Y-m-d H:i:s T"));
self::assertSame(48, count($header->getAttributes()));
}
public function testRfc822ParseHeaders() {
$mock = $this->getMockBuilder(Header::class)
->disableOriginalConstructor()
->onlyMethods([])
->getMock();
$config = new \ReflectionProperty($mock, 'options');
$config->setAccessible(true);
$config->setValue($mock, $this->config->get("options"));
$mockHeader = "Content-Type: text/csv; charset=WINDOWS-1252; name*0=\"TH_Is_a_F ile name example 20221013.c\"; name*1=sv\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Disposition: attachment; filename*0=\"TH_Is_a_F ile name example 20221013.c\"; filename*1=\"sv\"\r\n";
$expected = new \stdClass();
$expected->content_type = 'text/csv; charset=WINDOWS-1252; name*0="TH_Is_a_F ile name example 20221013.c"; name*1=sv';
$expected->content_transfer_encoding = 'quoted-printable';
$expected->content_disposition = 'attachment; filename*0="TH_Is_a_F ile name example 20221013.c"; filename*1="sv"';
$this->assertEquals($expected, $mock->rfc822_parse_headers($mockHeader));
}
public function testExtractHeaderExtensions() {
$mock = $this->getMockBuilder(Header::class)
->disableOriginalConstructor()
->onlyMethods([])
->getMock();
$method = new \ReflectionMethod($mock, 'extractHeaderExtensions');
$method->setAccessible(true);
$mockAttributes = [
'content_type' => new Attribute('content_type', 'text/csv; charset=WINDOWS-1252; name*0="TH_Is_a_F ile name example 20221013.c"; name*1=sv'),
'content_transfer_encoding' => new Attribute('content_transfer_encoding', 'quoted-printable'),
'content_disposition' => new Attribute('content_disposition', 'attachment; filename*0="TH_Is_a_F ile name example 20221013.c"; filename*1="sv"; attribute_test=attribute_test_value'),
];
$attributes = new \ReflectionProperty($mock, 'attributes');
$attributes->setAccessible(true);
$attributes->setValue($mock, $mockAttributes);
$method->invoke($mock);
$this->assertArrayHasKey('filename', $mock->getAttributes());
$this->assertArrayNotHasKey('filename*0', $mock->getAttributes());
$this->assertEquals('TH_Is_a_F ile name example 20221013.csv', $mock->get('filename'));
$this->assertArrayHasKey('name', $mock->getAttributes());
$this->assertArrayNotHasKey('name*0', $mock->getAttributes());
$this->assertEquals('TH_Is_a_F ile name example 20221013.csv', $mock->get('name'));
$this->assertArrayHasKey('content_type', $mock->getAttributes());
$this->assertEquals('text/csv', $mock->get('content_type')->last());
$this->assertArrayHasKey('charset', $mock->getAttributes());
$this->assertEquals('WINDOWS-1252', $mock->get('charset')->last());
$this->assertArrayHasKey('content_transfer_encoding', $mock->getAttributes());
$this->assertEquals('quoted-printable', $mock->get('content_transfer_encoding'));
$this->assertArrayHasKey('content_disposition', $mock->getAttributes());
$this->assertEquals('attachment', $mock->get('content_disposition')->last());
$this->assertEquals('quoted-printable', $mock->get('content_transfer_encoding'));
$this->assertArrayHasKey('attribute_test', $mock->getAttributes());
$this->assertEquals('attribute_test_value', $mock->get('attribute_test'));
}
}

View File

@@ -0,0 +1,52 @@
<?php
/*
* File: ImapProtocolTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 28.12.22 18:11
* Updated: -
*
* Description:
* -
*/
namespace Tests;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Connection\Protocols\ImapProtocol;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
class ImapProtocolTest extends TestCase {
/** @var Config $config */
protected Config $config;
/**
* Setup the test environment.
*
* @return void
*/
public function setUp(): void {
$this->config = Config::make();
}
/**
* ImapProtocol test
*
* @return void
*/
public function testImapProtocol(): void {
$protocol = new ImapProtocol($this->config, false);
self::assertSame(false, $protocol->getCertValidation());
self::assertSame("", $protocol->getEncryption());
$protocol->setCertValidation(true);
$protocol->setEncryption("ssl");
self::assertSame(true, $protocol->getCertValidation());
self::assertSame("ssl", $protocol->getEncryption());
}
}

View File

@@ -0,0 +1,302 @@
<?php
/*
* File: MessageTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 28.12.22 18:11
* Updated: -
*
* Description:
* -
*/
namespace Tests;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use ReflectionException;
use Webklex\PHPIMAP\Attachment;
use Webklex\PHPIMAP\Attribute;
use Webklex\PHPIMAP\Client;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Connection\Protocols\Response;
use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
use Webklex\PHPIMAP\Exceptions\MessageContentFetchingException;
use Webklex\PHPIMAP\Exceptions\MessageFlagException;
use Webklex\PHPIMAP\Exceptions\MessageNotFoundException;
use Webklex\PHPIMAP\Exceptions\MessageSizeFetchingException;
use Webklex\PHPIMAP\Exceptions\ResponseException;
use Webklex\PHPIMAP\IMAP;
use Webklex\PHPIMAP\Message;
use Webklex\PHPIMAP\Connection\Protocols\ImapProtocol;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
class MessageTest extends TestCase {
/** @var Message $message */
protected Message $message;
/** @var Client $client */
protected Client $client;
/** @var MockObject ImapProtocol mockup */
protected MockObject $protocol;
/**
* Setup the test environment.
*
* @return void
*/
public function setUp(): void {
$config = Config::make([
"accounts" => [
"default" => [
'protocol' => 'imap',
'encryption' => 'ssl',
'username' => 'foo@domain.tld',
'password' => 'bar',
'proxy' => [
'socket' => null,
'request_fulluri' => false,
'username' => null,
'password' => null,
],
]]
]);
$this->client = new Client($config);
}
/**
* Message test
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MessageContentFetchingException
* @throws MessageFlagException
* @throws MessageNotFoundException
* @throws MessageSizeFetchingException
* @throws ReflectionException
* @throws ResponseException
* @throws RuntimeException
*/
public function testMessage(): void {
$this->createNewProtocolMockup();
$email = file_get_contents(implode(DIRECTORY_SEPARATOR, [__DIR__, "messages", "1366671050@github.com.eml"]));
if(!str_contains($email, "\r\n")){
$email = str_replace("\n", "\r\n", $email);
}
$raw_header = substr($email, 0, strpos($email, "\r\n\r\n"));
$raw_body = substr($email, strlen($raw_header)+8);
$this->protocol->expects($this->any())->method('getUid')->willReturn(Response::empty()->setResult(22));
$this->protocol->expects($this->any())->method('getMessageNumber')->willReturn(Response::empty()->setResult(21));
$this->protocol->expects($this->any())->method('flags')->willReturn(Response::empty()->setResult([22 => [0 => "\\Seen"]]));
self::assertNotEmpty($this->client->openFolder("INBOX"));
$message = Message::make(22, null, $this->client, $raw_header, $raw_body, [0 => "\\Seen"], IMAP::ST_UID);
self::assertInstanceOf(Client::class, $message->getClient());
self::assertSame(22, $message->uid);
self::assertSame(21, $message->msgn);
self::assertContains("Seen", $message->flags()->toArray());
$subject = $message->get("subject");
$returnPath = $message->get("Return-Path");
self::assertInstanceOf(Attribute::class, $subject);
self::assertSame("Re: [Webklex/php-imap] Read all folders? (Issue #349)", $subject->toString());
self::assertSame("Re: [Webklex/php-imap] Read all folders? (Issue #349)", (string)$message->subject);
self::assertSame("<noreply@github.com>", $returnPath->toString());
self::assertSame("return_path", $returnPath->getName());
self::assertSame("-4.299", (string)$message->get("X-Spam-Score"));
self::assertSame("Webklex/php-imap/issues/349/1365266070@github.com", (string)$message->get("Message-ID"));
self::assertSame(6, $message->get("received")->count());
self::assertSame(IMAP::MESSAGE_PRIORITY_UNKNOWN, (int)$message->get("priority")());
}
/**
* Test getMessageNumber
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MessageNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testGetMessageNumber(): void {
$this->createNewProtocolMockup();
$this->protocol->expects($this->any())->method('getMessageNumber')->willReturn(Response::empty()->setResult(""));
self::assertNotEmpty($this->client->openFolder("INBOX"));
try {
$this->client->getConnection()->getMessageNumber(21)->validatedData();
$this->fail("Message number should not exist");
} catch (ResponseException $e) {
self::assertTrue(true);
}
}
/**
* Test loadMessageFromFile
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MaskNotFoundException
* @throws MessageContentFetchingException
* @throws MessageNotFoundException
* @throws ReflectionException
* @throws ResponseException
* @throws RuntimeException
* @throws MessageSizeFetchingException
*/
public function testLoadMessageFromFile(): void {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "messages", "1366671050@github.com.eml"]);
$message = Message::fromFile($filename);
$subject = $message->get("subject");
$returnPath = $message->get("Return-Path");
self::assertInstanceOf(Attribute::class, $subject);
self::assertSame("Re: [Webklex/php-imap] Read all folders? (Issue #349)", $subject->toString());
self::assertSame("Re: [Webklex/php-imap] Read all folders? (Issue #349)", (string)$message->subject);
self::assertSame("<noreply@github.com>", $returnPath->toString());
self::assertSame("return_path", $returnPath->getName());
self::assertSame("-4.299", (string)$message->get("X-Spam-Score"));
self::assertSame("Webklex/php-imap/issues/349/1365266070@github.com", (string)$message->get("Message-ID"));
self::assertSame(6, $message->get("received")->count());
self::assertSame(IMAP::MESSAGE_PRIORITY_UNKNOWN, (int)$message->get("priority")());
self::assertNull($message->getClient());
self::assertSame(0, $message->uid);
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "messages", "example_attachment.eml"]);
$message = Message::fromFile($filename);
$subject = $message->get("subject");
$returnPath = $message->get("Return-Path");
self::assertInstanceOf(Attribute::class, $subject);
self::assertSame("ogqMVHhz7swLaq2PfSWsZj0k99w8wtMbrb4RuHdNg53i76B7icIIM0zIWpwGFtnk", $subject->toString());
self::assertSame("ogqMVHhz7swLaq2PfSWsZj0k99w8wtMbrb4RuHdNg53i76B7icIIM0zIWpwGFtnk", (string)$message->subject);
self::assertSame("<someone@domain.tld>", $returnPath->toString());
self::assertSame("return_path", $returnPath->getName());
self::assertSame("1.103", (string)$message->get("X-Spam-Score"));
self::assertSame("d3a5e91963cb805cee975687d5acb1c6@swift.generated", (string)$message->get("Message-ID"));
self::assertSame(5, $message->get("received")->count());
self::assertSame(IMAP::MESSAGE_PRIORITY_HIGHEST, (int)$message->get("priority")());
self::assertNull($message->getClient());
self::assertSame(0, $message->uid);
self::assertSame(1, $message->getAttachments()->count());
/** @var Attachment $attachment */
$attachment = $message->getAttachments()->first();
self::assertSame("attachment", $attachment->disposition);
self::assertSame("znk551MP3TP3WPp9Kl1gnLErrWEgkJFAtvaKqkTgrk3dKI8dX38YT8BaVxRcOERN", $attachment->content);
self::assertSame("application/octet-stream", $attachment->content_type);
self::assertSame("6mfFxiU5Yhv9WYJx.txt", $attachment->name);
self::assertSame(2, $attachment->part_number);
self::assertSame("text", $attachment->type);
self::assertNotEmpty($attachment->id);
self::assertSame(90, $attachment->size);
self::assertSame("txt", $attachment->getExtension());
self::assertInstanceOf(Message::class, $attachment->getMessage());
self::assertSame("text/plain", $attachment->getMimeType());
}
/**
* Test issue #348
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MaskNotFoundException
* @throws MessageContentFetchingException
* @throws ReflectionException
* @throws ResponseException
* @throws RuntimeException
*/
public function testIssue348() {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "messages", "issue-348.eml"]);
$message = Message::fromFile($filename);
self::assertSame(1, $message->getAttachments()->count());
/** @var Attachment $attachment */
$attachment = $message->getAttachments()->first();
self::assertSame("attachment", $attachment->disposition);
self::assertSame("application/pdf", $attachment->content_type);
self::assertSame("Kelvinsong—Font_test_page_bold.pdf", $attachment->name);
self::assertSame(1, $attachment->part_number);
self::assertSame("text", $attachment->type);
self::assertNotEmpty($attachment->id);
self::assertSame(92384, $attachment->size);
self::assertSame("pdf", $attachment->getExtension());
self::assertInstanceOf(Message::class, $attachment->getMessage());
self::assertSame("application/pdf", $attachment->getMimeType());
}
/**
* Create a new protocol mockup
*
* @return void
*/
protected function createNewProtocolMockup(): void {
$this->protocol = $this->createMock(ImapProtocol::class);
$this->protocol->expects($this->any())->method('createStream')->willReturn(true);
$this->protocol->expects($this->any())->method('connected')->willReturn(true);
$this->protocol->expects($this->any())->method('getConnectionTimeout')->willReturn(30);
$this->protocol->expects($this->any())->method('logout')->willReturn(Response::empty()->setResponse([
0 => "BYE Logging out\r\n",
1 => "OK Logout completed (0.001 + 0.000 secs).\r\n",
]));
$this->protocol->expects($this->any())->method('selectFolder')->willReturn(Response::empty()->setResponse([
"flags" => [
0 => [
0 => "\Answered",
1 => "\Flagged",
2 => "\Deleted",
3 => "\Seen",
4 => "\Draft",
5 => "NonJunk",
6 => "unknown-1",
],
],
"exists" => 139,
"recent" => 0,
"unseen" => 94,
"uidvalidity" => 1488899637,
"uidnext" => 278,
]));
$this->client->connection = $this->protocol;
}
}

View File

@@ -0,0 +1,107 @@
<?php
/*
* File: StructureTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 28.12.22 18:11
* Updated: -
*
* Description:
* -
*/
namespace Tests;
use Carbon\Carbon;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
use Webklex\PHPIMAP\Exceptions\MessageContentFetchingException;
use Webklex\PHPIMAP\Header;
use Webklex\PHPIMAP\Part;
use Webklex\PHPIMAP\Structure;
use Webklex\PHPIMAP\IMAP;
class PartTest extends TestCase {
/** @var Config $config */
protected Config $config;
/**
* Setup the test environment.
*
* @return void
*/
public function setUp(): void {
$this->config = Config::make();
}
/**
* Test parsing a text Part
* @throws InvalidMessageDateException
*/
public function testTextPart(): void {
$raw_headers = "Content-Type: text/plain;\r\n charset=UTF-8\r\nContent-Transfer-Encoding: 7bit\r\n";
$raw_body = "\r\nAny updates?";
$headers = new Header($raw_headers, $this->config);
$part = new Part($raw_body, $this->config, $headers, 0);
self::assertSame("UTF-8", $part->charset);
self::assertSame("text/plain", $part->content_type);
self::assertSame(12, $part->bytes);
self::assertSame(0, $part->part_number);
self::assertSame(false, $part->ifdisposition);
self::assertSame(false, $part->isAttachment());
self::assertSame("Any updates?", $part->content);
self::assertSame(IMAP::MESSAGE_TYPE_TEXT, $part->type);
self::assertSame(IMAP::MESSAGE_ENC_7BIT, $part->encoding);
}
/**
* Test parsing a html Part
* @throws InvalidMessageDateException
*/
public function testHTMLPart(): void {
$raw_headers = "Content-Type: text/html;\r\n charset=UTF-8\r\nContent-Transfer-Encoding: 7bit\r\n";
$raw_body = "\r\n<p></p>\r\n<p dir=\"auto\">Any updates?</p>";
$headers = new Header($raw_headers, $this->config);
$part = new Part($raw_body, $this->config, $headers, 0);
self::assertSame("UTF-8", $part->charset);
self::assertSame("text/html", $part->content_type);
self::assertSame(39, $part->bytes);
self::assertSame(0, $part->part_number);
self::assertSame(false, $part->ifdisposition);
self::assertSame(false, $part->isAttachment());
self::assertSame("<p></p>\r\n<p dir=\"auto\">Any updates?</p>", $part->content);
self::assertSame(IMAP::MESSAGE_TYPE_TEXT, $part->type);
self::assertSame(IMAP::MESSAGE_ENC_7BIT, $part->encoding);
}
/**
* Test parsing a html Part
* @throws InvalidMessageDateException
*/
public function testBase64Part(): void {
$raw_headers = "Content-Type: application/octet-stream; name=6mfFxiU5Yhv9WYJx.txt\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=6mfFxiU5Yhv9WYJx.txt\r\n";
$raw_body = "em5rNTUxTVAzVFAzV1BwOUtsMWduTEVycldFZ2tKRkF0dmFLcWtUZ3JrM2RLSThkWDM4WVQ4QmFW\r\neFJjT0VSTg==";
$headers = new Header($raw_headers, $this->config);
$part = new Part($raw_body, $this->config, $headers, 0);
self::assertSame("", $part->charset);
self::assertSame("application/octet-stream", $part->content_type);
self::assertSame(90, $part->bytes);
self::assertSame(0, $part->part_number);
self::assertSame("znk551MP3TP3WPp9Kl1gnLErrWEgkJFAtvaKqkTgrk3dKI8dX38YT8BaVxRcOERN", base64_decode($part->content));
self::assertSame(true, $part->ifdisposition);
self::assertSame("attachment", $part->disposition);
self::assertSame("6mfFxiU5Yhv9WYJx.txt", $part->name);
self::assertSame("6mfFxiU5Yhv9WYJx.txt", $part->filename);
self::assertSame(true, $part->isAttachment());
self::assertSame(IMAP::MESSAGE_TYPE_TEXT, $part->type);
self::assertSame(IMAP::MESSAGE_ENC_BASE64, $part->encoding);
}
}

View File

@@ -0,0 +1,68 @@
<?php
/*
* File: StructureTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 28.12.22 18:11
* Updated: -
*
* Description:
* -
*/
namespace Tests;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
use Webklex\PHPIMAP\Exceptions\MessageContentFetchingException;
use Webklex\PHPIMAP\Header;
use Webklex\PHPIMAP\Structure;
class StructureTest extends TestCase {
/** @var Config $config */
protected Config $config;
/**
* Setup the test environment.
*
* @return void
*/
public function setUp(): void {
$this->config = Config::make();
}
/**
* Test parsing email headers
*
* @throws InvalidMessageDateException
* @throws MessageContentFetchingException
*/
public function testStructureParsing(): void {
$email = file_get_contents(implode(DIRECTORY_SEPARATOR, [__DIR__, "messages", "1366671050@github.com.eml"]));
if(!str_contains($email, "\r\n")){
$email = str_replace("\n", "\r\n", $email);
}
$raw_header = substr($email, 0, strpos($email, "\r\n\r\n"));
$raw_body = substr($email, strlen($raw_header)+8);
$header = new Header($raw_header, $this->config);
$structure = new Structure($raw_body, $header);
self::assertSame(2, count($structure->parts));
$textPart = $structure->parts[0];
self::assertSame("UTF-8", $textPart->charset);
self::assertSame("text/plain", $textPart->content_type);
self::assertSame(278, $textPart->bytes);
$htmlPart = $structure->parts[1];
self::assertSame("UTF-8", $htmlPart->charset);
self::assertSame("text/html", $htmlPart->content_type);
self::assertSame(1478, $htmlPart->bytes);
}
}

View File

@@ -0,0 +1,52 @@
<?php
/*
* File: AttachmentEncodedFilenameTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class AttachmentEncodedFilenameTest
*
* @package Tests\fixtures
*/
class AttachmentEncodedFilenameTest extends FixtureTestCase {
/**
* Test the fixture attachment_encoded_filename.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("attachment_encoded_filename.eml");
self::assertEquals("", $message->subject);
self::assertEquals("multipart/mixed", $message->content_type->last());
self::assertFalse($message->hasTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertCount(1, $message->attachments());
$attachment = $message->attachments()->first();
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("Prostřeno_2014_poslední volné termíny.xls", $attachment->filename);
self::assertEquals("Prostřeno_2014_poslední volné termíny.xls", $attachment->name);
self::assertEquals('xls', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("application/vnd.ms-excel", $attachment->content_type);
self::assertEquals("a0ef7cfbc05b73dbcb298fe0bc224b41900cdaf60f9904e3fea5ba6c7670013c", hash("sha256", $attachment->content));
self::assertEquals(146, $attachment->size);
self::assertEquals(0, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,79 @@
<?php
/*
* File: AttachmentLongFilenameTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class AttachmentLongFilenameTest
*
* @package Tests\fixtures
*/
class AttachmentLongFilenameTest extends FixtureTestCase {
/**
* Test the fixture attachment_long_filename.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("attachment_long_filename.eml");
self::assertEquals("", $message->subject);
self::assertEquals("multipart/mixed", $message->content_type->last());
self::assertFalse($message->hasTextBody());
self::assertFalse($message->hasHTMLBody());
$attachments = $message->attachments();
self::assertCount(3, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("Buchungsbestätigung- Rechnung-Geschäftsbedingungen-Nr.B123-45 - XXXX xxxxxxxxxxxxxxxxx XxxX, Lüdxxxxxxxx - VM Klaus XXXXXX - xxxxxxxx.pdf", $attachment->name);
self::assertEquals("Buchungsbestätigung- Rechnung-Geschäftsbedingungen-Nr.B123-45 - XXXXX xxxxxxxxxxxxxxxxx XxxX, Lüxxxxxxxxxx - VM Klaus XXXXXX - xxxxxxxx.pdf", $attachment->filename);
self::assertEquals('text', $attachment->type);
self::assertEquals('pdf', $attachment->getExtension());
self::assertEquals("text/plain", $attachment->content_type);
self::assertEquals("ca51ce1fb15acc6d69b8a5700256172fcc507e02073e6f19592e341bd6508ab8", hash("sha256", $attachment->content));
self::assertEquals(4, $attachment->size);
self::assertEquals(0, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[1];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals('01_A€àäąбيد@Z-0123456789-qwertyuiopasdfghjklzxcvbnmopqrstuvz-0123456789-qwertyuiopasdfghjklzxcvbnmopqrstuvz-0123456789-qwertyuiopasdfghjklzxcvbnmopqrstuvz.txt', $attachment->name);
self::assertEquals("f7b5181985862431bfc443d26e3af2371e20a0afd676eeb9b9595a26d42e0b73", hash("sha256", $attachment->filename));
self::assertEquals('text', $attachment->type);
self::assertEquals('txt', $attachment->getExtension());
self::assertEquals("text/plain", $attachment->content_type);
self::assertEquals("ca51ce1fb15acc6d69b8a5700256172fcc507e02073e6f19592e341bd6508ab8", hash("sha256", $attachment->content));
self::assertEquals(4, $attachment->size);
self::assertEquals(1, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[2];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals('02_A€àäąбيد@Z-0123456789-qwertyuiopasdfghjklzxcvbnmopqrstuvz-0123456789-qwertyuiopasdfghjklzxcvbnmopqrstuvz-0123456789-qwertyuiopasdfghjklzxcvbnmopqrstuvz.txt', $attachment->name);
self::assertEquals('02_A€àäąбيد@Z-0123456789-qwertyuiopasdfghjklzxcvbnmopqrstuvz-0123456789-qwertyuiopasdfghjklzxcvbnmopqrstuvz-0123456789-qwertyuiopasdfghjklzxcvbnmopqrstuvz.txt', $attachment->filename);
self::assertEquals('text', $attachment->type);
self::assertEquals("text/plain", $attachment->content_type);
self::assertEquals('txt', $attachment->getExtension());
self::assertEquals("ca51ce1fb15acc6d69b8a5700256172fcc507e02073e6f19592e341bd6508ab8", hash("sha256", $attachment->content));
self::assertEquals(4, $attachment->size);
self::assertEquals(2, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,55 @@
<?php
/*
* File: AttachmentNoDispositionTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class AttachmentNoDispositionTest
*
* @package Tests\fixtures
*/
class AttachmentNoDispositionTest extends FixtureTestCase {
/**
* Test the fixture attachment_no_disposition.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("attachment_no_disposition.eml");
self::assertEquals("", $message->subject);
self::assertEquals("multipart/mixed", $message->content_type->last());
self::assertFalse($message->hasTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertCount(1, $message->attachments());
$attachment = $message->attachments()->first();
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals('26ed3dd2', $attachment->filename);
self::assertEquals('26ed3dd2', $attachment->id);
self::assertEquals("Prostřeno_2014_poslední volné termíny.xls", $attachment->name);
self::assertEquals('text', $attachment->type);
self::assertEquals('xls', $attachment->getExtension());
self::assertEquals("application/vnd.ms-excel", $attachment->content_type);
self::assertEquals("a0ef7cfbc05b73dbcb298fe0bc224b41900cdaf60f9904e3fea5ba6c7670013c", hash("sha256", $attachment->content));
self::assertEquals(146, $attachment->size);
self::assertEquals(0, $attachment->part_number);
self::assertNull($attachment->disposition);
self::assertNotEmpty($attachment->id);
self::assertEmpty($attachment->content_id);
}
}

View File

@@ -0,0 +1,43 @@
<?php
/*
* File: BccTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class BccTest
*
* @package Tests\fixtures
*/
class BccTest extends FixtureTestCase {
/**
* Test the fixture bcc.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("bcc.eml");
self::assertEquals("test", $message->subject);
self::assertEquals("<return-path@here.com>", $message->return_path);
self::assertEquals("1.0", $message->mime_version);
self::assertEquals("text/plain", $message->content_type);
self::assertEquals("Hi!", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-27 10:48:51", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from);
self::assertEquals("to@here.com", $message->to);
self::assertEquals("A_€@{è_Z <bcc@here.com>", $message->bcc);
self::assertEquals("sender@here.com", $message->sender);
self::assertEquals("reply-to@here.com", $message->reply_to);
}
}

View File

@@ -0,0 +1,55 @@
<?php
/*
* File: BooleanDecodedContentTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class BooleanDecodedContentTest
*
* @package Tests\fixtures
*/
class BooleanDecodedContentTest extends FixtureTestCase {
/**
* Test the fixture boolean_decoded_content.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("boolean_decoded_content.eml");
self::assertEquals("Nuu", $message->subject);
self::assertEquals("Here is the problem mail\r\n \r\nBody text", $message->getTextBody());
self::assertEquals("Here is the problem mail\r\n \r\nBody text", $message->getHTMLBody());
self::assertEquals("2017-09-13 11:05:45", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from);
self::assertEquals("to@here.com", $message->to);
$attachments = $message->getAttachments();
self::assertCount(1, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("Example Domain.pdf", $attachment->name);
self::assertEquals('text', $attachment->type);
self::assertEquals('pdf', $attachment->getExtension());
self::assertEquals("application/pdf", $attachment->content_type);
self::assertEquals("1c449aaab4f509012fa5eaa180fd017eb7724ccacabdffc1c6066d3756dcde5c", hash("sha256", $attachment->content));
self::assertEquals(53, $attachment->size);
self::assertEquals(3, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,115 @@
<?php
/*
* File: DateTemplateTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\MessageContentFetchingException;
use Webklex\PHPIMAP\Exceptions\ResponseException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
use Webklex\PHPIMAP\Message;
use \ReflectionException;
/**
* Class DateTemplateTest
*
* @package Tests\fixtures
*/
class DateTemplateTest extends FixtureTestCase {
/**
* Test if the date is parsed correctly
* @var array|string[] $dates
*/
protected array $dates = [
"Fri, 5 Apr 2019 12:10:49 +0200" => "2019-04-05 10:10:49",
"04 Jan 2018 10:12:47 UT" => "2018-01-04 10:12:47",
"22 Jun 18 03:56:36 PM -05:00 (GMT -05:00)" => "2018-06-22 20:56:36",
"Sat, 31 Aug 2013 20:08:23 +0580" => "2013-08-31 14:38:23",
"Fri, 1 Feb 2019 01:30:04 +0600 (+06)" => "2019-01-31 19:30:04",
"Mon, 4 Feb 2019 04:03:49 -0300 (-03)" => "2019-02-04 07:03:49",
"Sun, 6 Apr 2008 21:24:33 UT" => "2008-04-06 21:24:33",
"Wed, 11 Sep 2019 15:23:06 +0600 (+06)" => "2019-09-11 09:23:06",
"14 Sep 2019 00:10:08 UT +0200" => "2019-09-14 00:10:08",
"Tue, 08 Nov 2022 18:47:20 +0000 14:03:33 +0000" => "2022-11-08 18:47:20",
"Sat, 10, Dec 2022 09:35:19 +0100" => "2022-12-10 08:35:19",
"Thur, 16 Mar 2023 15:33:07 +0400" => "2023-03-16 11:33:07",
"fr., 25 nov. 2022 06:27:14 +0100/fr., 25 nov. 2022 06:27:14 +0100" => "2022-11-25 05:27:14",
"Di., 15 Feb. 2022 06:52:44 +0100 (MEZ)/Di., 15 Feb. 2022 06:52:44 +0100 (MEZ)" => "2022-02-15 05:52:44",
];
/**
* Test the fixture date-template.eml
*
* @return void
* @throws InvalidMessageDateException
* @throws ReflectionException
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws MessageContentFetchingException
* @throws ResponseException
* @throws RuntimeException
*/
public function testFixture() : void {
try {
$message = $this->getFixture("date-template.eml");
$this->fail("Expected InvalidMessageDateException");
} catch (InvalidMessageDateException $e) {
self::assertTrue(true);
}
self::$manager->setConfig([
"options" => [
"fallback_date" => "2021-01-01 00:00:00",
],
]);
$message = $this->getFixture("date-template.eml", self::$manager->getConfig());
self::assertEquals("test", $message->subject);
self::assertEquals("1.0", $message->mime_version);
self::assertEquals("Hi!", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2021-01-01 00:00:00", $message->date->first()->timezone("UTC")->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", (string)$message->from);
self::assertEquals("to@here.com", $message->to);
self::$manager->setConfig([
"options" => [
"fallback_date" => null,
],
]);
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "date-template.eml"]);
$blob = file_get_contents($filename);
self::assertNotFalse($blob);
foreach ($this->dates as $date => $expected) {
$message = Message::fromString(str_replace("%date_raw_header%", $date, $blob));
self::assertEquals("test", $message->subject);
self::assertEquals("1.0", $message->mime_version);
self::assertEquals("Hi!", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals($expected, $message->date->first()->timezone("UTC")->format("Y-m-d H:i:s"), "Date \"$date\" should be \"$expected\"");
self::assertEquals("from@there.com", (string)$message->from);
self::assertEquals("to@here.com", $message->to);
}
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* File: EmailAddressTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class EmailAddressTest
*
* @package Tests\fixtures
*/
class EmailAddressTest extends FixtureTestCase {
/**
* Test the fixture email_address.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("email_address.eml");
self::assertEquals("", $message->subject);
self::assertEquals("123@example.com", $message->message_id);
self::assertEquals("Hi\r\nHow are you?", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertFalse($message->date->first());
self::assertEquals("no_host@UNKNOWN", (string)$message->from);
self::assertEquals("", $message->to);
self::assertEquals("This one: is \"right\" <ding@dong.com>, No-address@UNKNOWN", $message->cc);
}
}

View File

@@ -0,0 +1,64 @@
<?php
/*
* File: EmbeddedEmailTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class EmbeddedEmailTest
*
* @package Tests\fixtures
*/
class EmbeddedEmailTest extends FixtureTestCase {
/**
* Test the fixture embedded_email.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("embedded_email.eml");
self::assertEquals("embedded message", $message->subject);
self::assertEquals([
'from webmail.my-office.cz (localhost [127.0.0.1]) by keira.cofis.cz ; Fri, 29 Jan 2016 14:25:40 +0100',
'from webmail.my-office.cz (localhost [127.0.0.1]) by keira.cofis.cz'
], $message->received->toArray());
self::assertEquals("7e5798da5747415e5b82fdce042ab2a6@cerstor.cz", $message->message_id);
self::assertEquals("demo@cerstor.cz", $message->return_path);
self::assertEquals("1.0", $message->mime_version);
self::assertEquals("Roundcube Webmail/1.0.0", $message->user_agent);
self::assertEquals("email that contains embedded message", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2016-01-29 13:25:40", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("demo@cerstor.cz", $message->from);
self::assertEquals("demo@cerstor.cz", $message->x_sender);
self::assertEquals("demo@cerstor.cz", $message->to);
$attachments = $message->getAttachments();
self::assertCount(1, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("demo.eml", $attachment->name);
self::assertEquals('text', $attachment->type);
self::assertEquals('eml', $attachment->getExtension());
self::assertEquals("message/rfc822", $attachment->content_type);
self::assertEquals("a1f965f10a9872e902a82dde039a237e863f522d238a1cb1968fe3396dbcac65", hash("sha256", $attachment->content));
self::assertEquals(893, $attachment->size);
self::assertEquals(1, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,75 @@
<?php
/*
* File: EmbeddedEmailWithoutContentDispositionEmbeddedTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class EmbeddedEmailWithoutContentDispositionEmbeddedTest
*
* @package Tests\fixtures
*/
class EmbeddedEmailWithoutContentDispositionEmbeddedTest extends FixtureTestCase {
/**
* Test the fixture embedded_email_without_content_disposition-embedded.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("embedded_email_without_content_disposition-embedded.eml");
self::assertEquals("embedded_message_subject", $message->subject);
self::assertEquals([
'from webmail.my-office.cz (localhost [127.0.0.1]) by keira.cofis.cz ; Fri, 29 Jan 2016 14:25:40 +0100',
'from webmail.my-office.cz (localhost [127.0.0.1]) by keira.cofis.cz'
], $message->received->toArray());
self::assertEquals("AC39946EBF5C034B87BABD5343E96979012671D40E38@VM002.cerk.cc", $message->message_id);
self::assertEquals("pl-PL, nl-NL", $message->accept_language);
self::assertEquals("pl-PL", $message->content_language);
self::assertEquals("1.0", $message->mime_version);
self::assertEquals("some txt", $message->getTextBody());
self::assertEquals("<html>\r\n <p>some txt</p>\r\n</html>", $message->getHTMLBody());
self::assertEquals("2019-04-05 10:10:49", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("demo@cerstor.cz", $message->from);
self::assertEquals("demo@cerstor.cz", $message->to);
$attachments = $message->getAttachments();
self::assertCount(2, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("file1.xlsx", $attachment->name);
self::assertEquals('text', $attachment->type);
self::assertEquals('xlsx', $attachment->getExtension());
self::assertEquals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $attachment->content_type);
self::assertEquals("87737d24c106b96e177f9564af6712e2c6d3e932c0632bfbab69c88b0bb934dc", hash("sha256", $attachment->content));
self::assertEquals(40, $attachment->size);
self::assertEquals(3, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[1];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("file2.xlsx", $attachment->name);
self::assertEquals('xlsx', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $attachment->content_type);
self::assertEquals("87737d24c106b96e177f9564af6712e2c6d3e932c0632bfbab69c88b0bb934dc", hash("sha256", $attachment->content));
self::assertEquals(40, $attachment->size);
self::assertEquals(4, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,98 @@
<?php
/*
* File: EmbeddedEmailWithoutContentDispositionTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class EmbeddedEmailWithoutContentDispositionTest
*
* @package Tests\fixtures
*/
class EmbeddedEmailWithoutContentDispositionTest extends FixtureTestCase {
/**
* Test the fixture embedded_email_without_content_disposition.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("embedded_email_without_content_disposition.eml");
self::assertEquals("Subject", $message->subject);
self::assertEquals([
'from webmail.my-office.cz (localhost [127.0.0.1]) by keira.cofis.cz ; Fri, 29 Jan 2016 14:25:40 +0100',
'from webmail.my-office.cz (localhost [127.0.0.1]) by keira.cofis.cz'
], $message->received->toArray());
self::assertEquals("AC39946EBF5C034B87BABD5343E96979012671D9F7E4@VM002.cerk.cc", $message->message_id);
self::assertEquals("pl-PL, nl-NL", $message->accept_language);
self::assertEquals("1.0", $message->mime_version);
self::assertEquals("TexT\r\n\r\n[cid:file.jpg]", $message->getTextBody());
self::assertEquals("<html><p>TexT</p></html>", $message->getHTMLBody());
self::assertEquals("2019-04-05 11:48:50", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("demo@cerstor.cz", $message->from);
self::assertEquals("demo@cerstor.cz", $message->to);
$attachments = $message->getAttachments();
self::assertCount(4, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("file.jpg", $attachment->name);
self::assertEquals('jpg', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("image/jpeg", $attachment->content_type);
self::assertEquals("6b7fa434f92a8b80aab02d9bf1a12e49ffcae424e4013a1c4f68b67e3d2bbcd0", hash("sha256", $attachment->content));
self::assertEquals(96, $attachment->size);
self::assertEquals(3, $attachment->part_number);
self::assertEquals("inline", $attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[1];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals('a1abc19a', $attachment->name);
self::assertEquals('text', $attachment->type);
self::assertEquals('', $attachment->getExtension());
self::assertEquals("message/rfc822", $attachment->content_type);
self::assertEquals("2476c8b91a93c6b2fe1bfff593cb55956c2fe8e7ca6de9ad2dc9d101efe7a867", hash("sha256", $attachment->content));
self::assertEquals(2073, $attachment->size);
self::assertEquals(5, $attachment->part_number);
self::assertNull($attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[2];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("file3.xlsx", $attachment->name);
self::assertEquals('xlsx', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $attachment->content_type);
self::assertEquals("87737d24c106b96e177f9564af6712e2c6d3e932c0632bfbab69c88b0bb934dc", hash("sha256", $attachment->content));
self::assertEquals(40, $attachment->size);
self::assertEquals(6, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[3];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("file4.zip", $attachment->name);
self::assertEquals('zip', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("application/x-zip-compressed", $attachment->content_type);
self::assertEquals("87737d24c106b96e177f9564af6712e2c6d3e932c0632bfbab69c88b0bb934dc", hash("sha256", $attachment->content));
self::assertEquals(40, $attachment->size);
self::assertEquals(7, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,99 @@
<?php
/*
* File: ExampleBounceTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class ExampleBounceTest
*
* @package Tests\fixtures
*/
class ExampleBounceTest extends FixtureTestCase {
/**
* Test the fixture example_bounce.eml
*
* @return void
*/
public function testFixture(): void {
$message = $this->getFixture("example_bounce.eml");
self::assertEquals("<>", $message->return_path);
self::assertEquals([
0 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>); Thu, 02 Mar 2023 05:27:29 +0100',
1 => 'from somewhere06.your-server.de ([1b21:2f8:e0a:50e4::2]) by somewhere.your-server.de with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) id 1pXaXR-0006xQ-BN for demo@foo.de; Thu, 02 Mar 2023 05:27:29 +0100',
2 => 'from [192.168.0.10] (helo=sslproxy01.your-server.de) by somewhere06.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-000LYP-9R for demo@foo.de; Thu, 02 Mar 2023 05:27:26 +0100',
3 => 'from localhost ([127.0.0.1] helo=sslproxy01.your-server.de) by sslproxy01.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-0008gy-7x for demo@foo.de; Thu, 02 Mar 2023 05:27:26 +0100',
4 => 'from Debian-exim by sslproxy01.your-server.de with local (Exim 4.92) id 1pXaXO-0008gb-6g for demo@foo.de; Thu, 02 Mar 2023 05:27:26 +0100',
5 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>)',
], $message->received->all());
self::assertEquals("demo@foo.de", $message->envelope_to);
self::assertEquals("Thu, 02 Mar 2023 05:27:29 +0100", $message->delivery_date);
self::assertEquals([
0 => 'somewhere.your-server.de; iprev=pass (somewhere06.your-server.de) smtp.remote-ip=1b21:2f8:e0a:50e4::2; spf=none smtp.mailfrom=<>; dmarc=skipped',
1 => 'somewhere.your-server.de'
], $message->authentication_results->all());
self::assertEquals([
0 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>); Thu, 02 Mar 2023 05:27:29 +0100',
1 => 'from somewhere06.your-server.de ([1b21:2f8:e0a:50e4::2]) by somewhere.your-server.de with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) id 1pXaXR-0006xQ-BN for demo@foo.de; Thu, 02 Mar 2023 05:27:29 +0100',
2 => 'from [192.168.0.10] (helo=sslproxy01.your-server.de) by somewhere06.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-000LYP-9R for demo@foo.de; Thu, 02 Mar 2023 05:27:26 +0100',
3 => 'from localhost ([127.0.0.1] helo=sslproxy01.your-server.de) by sslproxy01.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) id 1pXaXO-0008gy-7x for demo@foo.de; Thu, 02 Mar 2023 05:27:26 +0100',
4 => 'from Debian-exim by sslproxy01.your-server.de with local (Exim 4.92) id 1pXaXO-0008gb-6g for demo@foo.de; Thu, 02 Mar 2023 05:27:26 +0100',
5 => 'from somewhere.your-server.de by somewhere.your-server.de with LMTP id 3TP8LrElAGSOaAAAmBr1xw (envelope-from <>)',
], $message->received->all());
self::assertEquals("ding@ding.de", $message->x_failed_recipients);
self::assertEquals("auto-replied", $message->auto_submitted);
self::assertEquals("Mail Delivery System <Mailer-Daemon@sslproxy01.your-server.de>", $message->from);
self::assertEquals("demo@foo.de", $message->to);
self::assertEquals("1.0", $message->mime_version);
self::assertEquals("Mail delivery failed", $message->subject);
self::assertEquals("E1pXaXO-0008gb-6g@sslproxy01.your-server.de", $message->message_id);
self::assertEquals("2023-03-02 04:27:26", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("Clear (ClamAV 0.103.8/26827/Wed Mar 1 09:28:49 2023)", $message->x_virus_scanned);
self::assertEquals("0.0 (/)", $message->x_spam_score);
self::assertEquals("bar-demo@foo.de", $message->delivered_to);
self::assertEquals("multipart/report", $message->content_type->last());
self::assertEquals("5d4847c21c8891e73d62c8246f260a46496958041a499f33ecd47444fdaa591b", hash("sha256", $message->getTextBody()));
self::assertFalse($message->hasHTMLBody());
$attachments = $message->attachments();
self::assertCount(2, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals('c541a506', $attachment->filename);
self::assertEquals("c541a506", $attachment->name);
self::assertEquals('', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("message/delivery-status", $attachment->content_type);
self::assertEquals("85ac09d1d74b2d85853084dc22abcad205a6bfde62d6056e3a933ffe7e82e45c", hash("sha256", $attachment->content));
self::assertEquals(267, $attachment->size);
self::assertEquals(1, $attachment->part_number);
self::assertNull($attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[1];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals('da786518', $attachment->filename);
self::assertEquals("da786518", $attachment->name);
self::assertEquals('', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("message/rfc822", $attachment->content_type);
self::assertEquals("7525331f5fab23ea77f595b995336aca7b8dad12db00ada14abebe7fe5b96e10", hash("sha256", $attachment->content));
self::assertEquals(776, $attachment->size);
self::assertEquals(2, $attachment->part_number);
self::assertNull($attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,94 @@
<?php
/*
* File: FixtureTestCase.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\MessageContentFetchingException;
use Webklex\PHPIMAP\Exceptions\ResponseException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
use Webklex\PHPIMAP\Message;
use \ReflectionException;
/**
* Class FixtureTestCase
*
* @package Tests\fixtures
*/
abstract class FixtureTestCase extends TestCase {
/**
* Client manager
* @var ClientManager $manager
*/
protected static ClientManager $manager;
/**
* FixtureTestCase constructor.
* @param string|null $name
* @param array $data
* @param $dataName
*/
final public function __construct(?string $name = null, array $data = [], $dataName = '') {
parent::__construct($name, $data, $dataName);
self::$manager = new ClientManager([
'options' => [
"debug" => $_ENV["LIVE_MAILBOX_DEBUG"] ?? false,
],
'accounts' => [
'default' => [
'host' => getenv("LIVE_MAILBOX_HOST"),
'port' => getenv("LIVE_MAILBOX_PORT"),
'encryption' => getenv("LIVE_MAILBOX_ENCRYPTION"),
'validate_cert' => getenv("LIVE_MAILBOX_VALIDATE_CERT"),
'username' => getenv("LIVE_MAILBOX_USERNAME"),
'password' => getenv("LIVE_MAILBOX_PASSWORD"),
'protocol' => 'imap', //might also use imap, [pop3 or nntp (untested)]
],
],
]);
return self::$manager;
}
/**
* Get a fixture message
* @param string $template
*
* @return Message
* @throws ReflectionException
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MaskNotFoundException
* @throws MessageContentFetchingException
* @throws ResponseException
* @throws RuntimeException
*/
final public function getFixture(string $template, Config $config = null) : Message {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", $template]);
$message = Message::fromFile($filename, $config);
self::assertInstanceOf(Message::class, $message);
return $message;
}
}

View File

@@ -0,0 +1,55 @@
<?php
/*
* File: FourNestedEmailsTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class FourNestedEmailsTest
*
* @package Tests\fixtures
*/
class FourNestedEmailsTest extends FixtureTestCase {
/**
* Test the fixture four_nested_emails.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("four_nested_emails.eml");
self::assertEquals("3-third-subject", $message->subject);
self::assertEquals("3-third-content", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertFalse($message->date->first());
self::assertEquals("test@example.com", $message->from->first()->mail);
self::assertEquals("test@example.com", $message->to->first()->mail);
$attachments = $message->getAttachments();
self::assertCount(1, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("2-second-email.eml", $attachment->name);
self::assertEquals('text', $attachment->type);
self::assertEquals('eml', $attachment->getExtension());
self::assertEquals("message/rfc822", $attachment->content_type);
self::assertEquals("85012e6a26d064a0288ee62618b3192687385adb4a4e27e48a28f738a325ca46", hash("sha256", $attachment->content));
self::assertEquals(1376, $attachment->size);
self::assertEquals(2, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* File: GbkCharsetTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class GbkCharsetTest
*
* @package Tests\fixtures
*/
class GbkCharsetTest extends FixtureTestCase {
/**
* Test the fixture gbk_charset.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("gbk_charset.eml");
self::assertEquals("Nuu", $message->subject);
self::assertEquals("Hi", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-13 11:05:45", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* File: HtmlOnlyTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class HtmlOnlyTest
*
* @package Tests\fixtures
*/
class HtmlOnlyTest extends FixtureTestCase {
/**
* Test the fixture html_only.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("html_only.eml");
self::assertEquals("Nuu", $message->subject);
self::assertEquals("<html><body>Hi</body></html>", $message->getHTMLBody());
self::assertFalse($message->hasTextBody());
self::assertEquals("2017-09-13 11:05:45", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* File: ImapMimeHeaderDecodeReturnsFalseTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class ImapMimeHeaderDecodeReturnsFalseTest
*
* @package Tests\fixtures
*/
class ImapMimeHeaderDecodeReturnsFalseTest extends FixtureTestCase {
/**
* Test the fixture imap_mime_header_decode_returns_false.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("imap_mime_header_decode_returns_false.eml");
self::assertEquals("=?UTF-8?B?nnDusSNdG92w6Fuw61fMjAxOF8wMy0xMzMyNTMzMTkzLnBkZg==?=", $message->subject->first());
self::assertEquals("Hi", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-13 11:05:45", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
}
}

View File

@@ -0,0 +1,62 @@
<?php
/*
* File: InlineAttachmentTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
use Webklex\PHPIMAP\Support\AttachmentCollection;
/**
* Class InlineAttachmentTest
*
* @package Tests\fixtures
*/
class InlineAttachmentTest extends FixtureTestCase {
/**
* Test the fixture inline_attachment.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("inline_attachment.eml");
self::assertEquals("", $message->subject);
self::assertFalse($message->hasTextBody());
self::assertEquals('<img style="height: auto;" src="cid:ii_15f0aad691bb745f" border="0"/>', $message->getHTMLBody());
self::assertFalse($message->date->first());
self::assertFalse($message->from->first());
self::assertFalse($message->to->first());
$attachments = $message->attachments();
self::assertInstanceOf(AttachmentCollection::class, $attachments);
self::assertCount(1, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals('d2913999', $attachment->name);
self::assertEquals('d2913999', $attachment->filename);
self::assertEquals('ii_15f0aad691bb745f', $attachment->id);
self::assertEquals('text', $attachment->type);
self::assertEquals('', $attachment->getExtension());
self::assertEquals("image/png", $attachment->content_type);
self::assertEquals("6568c9e9c35a7fa06f236e89f704d8c9b47183a24f2c978dba6c92e2747e3a13", hash("sha256", $attachment->content));
self::assertEquals(1486, $attachment->size);
self::assertEquals(1, $attachment->part_number);
self::assertEquals("inline", $attachment->disposition);
self::assertEquals("<ii_15f0aad691bb745f>", $attachment->content_id);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,46 @@
<?php
/*
* File: KsC56011987HeadersTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class KsC56011987HeadersTest
*
* @package Tests\fixtures
*/
class KsC56011987HeadersTest extends FixtureTestCase {
/**
* Test the fixture ks_c_5601-1987_headers.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("ks_c_5601-1987_headers.eml");
self::assertEquals("RE: 회원님께 Ersi님이 메시지를 보냈습니다.", $message->subject);
self::assertEquals("=?ks_c_5601-1987?B?yLi/+LTUsrIgRXJzabTUwMwguN69w8H2uKYgurizwr3AtM+02S4=?=", $message->thread_topic);
self::assertEquals("1.0", $message->mime_version);
self::assertEquals("Content", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-27 10:48:51", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("to@here.com", $message->to->first()->mail);
$from = $message->from->first();
self::assertEquals("김 현진", $from->personal);
self::assertEquals("from", $from->mailbox);
self::assertEquals("there.com", $from->host);
self::assertEquals("from@there.com", $from->mail);
self::assertEquals("김 현진 <from@there.com>", $from->full);
}
}

View File

@@ -0,0 +1,63 @@
<?php
/*
* File: MailThatIsAttachmentTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class MailThatIsAttachmentTest
*
* @package Tests\fixtures
*/
class MailThatIsAttachmentTest extends FixtureTestCase {
/**
* Test the fixture mail_that_is_attachment.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("mail_that_is_attachment.eml");
self::assertEquals("Report domain: yyy.cz Submitter: google.com Report-ID: 2244696771454641389", $message->subject);
self::assertEquals("2244696771454641389@google.com", $message->message_id);
self::assertEquals("1.0", $message->mime_version);
self::assertFalse($message->hasTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2015-02-15 10:21:51", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("xxx@yyy.cz", $message->to->first()->mail);
self::assertEquals("xxx@yyy.cz", $message->sender->first()->mail);
$from = $message->from->first();
self::assertEquals("noreply-dmarc-support via xxx", $from->personal);
self::assertEquals("xxx", $from->mailbox);
self::assertEquals("yyy.cz", $from->host);
self::assertEquals("xxx@yyy.cz", $from->mail);
self::assertEquals("noreply-dmarc-support via xxx <xxx@yyy.cz>", $from->full);
self::assertCount(1, $message->attachments());
$attachment = $message->attachments()->first();
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("google.com!yyy.cz!1423872000!1423958399.zip", $attachment->name);
self::assertEquals('zip', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("application/zip", $attachment->content_type);
self::assertEquals("c0d4f47b6fde124cea7460c3e509440d1a062705f550b0502b8ba0cbf621c97a", hash("sha256", $attachment->content));
self::assertEquals(1062, $attachment->size);
self::assertEquals(0, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* File: MissingDateTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class MissingDateTest
*
* @package Tests\fixtures
*/
class MissingDateTest extends FixtureTestCase {
/**
* Test the fixture missing_date.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("missing_date.eml");
self::assertEquals("Nuu", $message->getSubject());
self::assertEquals("Hi", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertFalse($message->date->first());
self::assertEquals("from@here.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* File: MissingFromTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class MissingFromTest
*
* @package Tests\fixtures
*/
class MissingFromTest extends FixtureTestCase {
/**
* Test the fixture missing_from.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("missing_from.eml");
self::assertEquals("Nuu", $message->getSubject());
self::assertEquals("Hi", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-13 11:05:45", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertFalse($message->from->first());
self::assertEquals("to@here.com", $message->to->first()->mail);
}
}

View File

@@ -0,0 +1,61 @@
<?php
/*
* File: MixedFilenameTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class MixedFilenameTest
*
* @package Tests\fixtures
*/
class MixedFilenameTest extends FixtureTestCase {
/**
* Test the fixture mixed_filename.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("mixed_filename.eml");
self::assertEquals("Свежий прайс-лист", $message->subject);
self::assertFalse($message->hasTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2018-02-02 19:23:06", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
$from = $message->from->first();
self::assertEquals("Прайсы || ПартКом", $from->personal);
self::assertEquals("support", $from->mailbox);
self::assertEquals("part-kom.ru", $from->host);
self::assertEquals("support@part-kom.ru", $from->mail);
self::assertEquals("Прайсы || ПартКом <support@part-kom.ru>", $from->full);
self::assertEquals("foo@bar.com", $message->to->first());
self::assertCount(1, $message->attachments());
$attachment = $message->attachments()->first();
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("Price4VladDaKar.xlsx", $attachment->name);
self::assertEquals('xlsx', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("application/octet-stream", $attachment->content_type);
self::assertEquals("b832983842b0ad65db69e4c7096444c540a2393e2d43f70c2c9b8b9fceeedbb1", hash('sha256', $attachment->content));
self::assertEquals(94, $attachment->size);
self::assertEquals(2, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,63 @@
<?php
/*
* File: MultipartWithoutBodyTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class MultipartWithoutBodyTest
*
* @package Tests\fixtures
*/
class MultipartWithoutBodyTest extends FixtureTestCase {
/**
* Test the fixture multipart_without_body.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("multipart_without_body.eml");
self::assertEquals("This mail will not contain a body", $message->subject);
self::assertEquals("This mail will not contain a body", $message->getTextBody());
self::assertEquals("d76dfb1ff3231e3efe1675c971ce73f722b906cc049d328db0d255f8d3f65568", hash("sha256", $message->getHTMLBody()));
self::assertEquals("2023-03-11 08:24:31", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("Foo Bülow Bar <from@example.com>", $message->from);
self::assertEquals("some one <someone@somewhere.com>", $message->to);
self::assertEquals([
0 => 'from AS8PR02MB6805.eurprd02.prod.outlook.com (2603:10a6:20b:252::8) by PA4PR02MB7071.eurprd02.prod.outlook.com with HTTPS; Sat, 11 Mar 2023 08:24:33 +0000',
1 => 'from omef0ahNgeoJu.eurprd02.prod.outlook.com (2603:10a6:10:33c::12) by AS8PR02MB6805.eurprd02.prod.outlook.com (2603:10a6:20b:252::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.19; Sat, 11 Mar 2023 08:24:31 +0000',
2 => 'from omef0ahNgeoJu.eurprd02.prod.outlook.com ([fe80::38c0:9c40:7fc6:93a7]) by omef0ahNgeoJu.eurprd02.prod.outlook.com ([fe80::38c0:9c40:7fc6:93a7%7]) with mapi id 15.20.6178.019; Sat, 11 Mar 2023 08:24:31 +0000',
3 => 'from AS8PR02MB6805.eurprd02.prod.outlook.com (2603:10a6:20b:252::8) by PA4PR02MB7071.eurprd02.prod.outlook.com with HTTPS',
], $message->received->all());
self::assertEquals("This mail will not contain a body", $message->thread_topic);
self::assertEquals("AdlT8uVmpHPvImbCRM6E9LODIvAcQA==", $message->thread_index);
self::assertEquals("omef0ahNgeoJuEB51C568ED2227A2DAABB5BB9@omef0ahNgeoJu.eurprd02.prod.outlook.com", $message->message_id);
self::assertEquals("da-DK, en-US", $message->accept_language);
self::assertEquals("en-US", $message->content_language);
self::assertEquals("Internal", $message->x_ms_exchange_organization_authAs);
self::assertEquals("04", $message->x_ms_exchange_organization_authMechanism);
self::assertEquals("omef0ahNgeoJu.eurprd02.prod.outlook.com", $message->x_ms_exchange_organization_authSource);
self::assertEquals("", $message->x_ms_Has_Attach);
self::assertEquals("aa546a02-2b7a-4fb1-7fd4-08db220a09f1", $message->x_ms_exchange_organization_Network_Message_Id);
self::assertEquals("-1", $message->x_ms_exchange_organization_SCL);
self::assertEquals("", $message->x_ms_TNEF_Correlator);
self::assertEquals("0", $message->x_ms_exchange_organization_RecordReviewCfmType);
self::assertEquals("Email", $message->x_ms_publictraffictype);
self::assertEquals("ucf:0;jmr:0;auth:0;dest:I;ENG:(910001)(944506478)(944626604)(920097)(425001)(930097);", $message->X_Microsoft_Antispam_Mailbox_Delivery->first());
self::assertEquals("0712b5fe22cf6e75fa220501c1a6715a61098983df9e69bad4000c07531c1295", hash("sha256", $message->X_Microsoft_Antispam_Message_Info));
self::assertEquals("multipart/alternative", $message->Content_Type->last());
self::assertEquals("1.0", $message->mime_version);
self::assertCount(0, $message->getAttachments());
}
}

View File

@@ -0,0 +1,76 @@
<?php
/*
* File: MultipleHtmlPartsAndAttachmentsTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
use Webklex\PHPIMAP\Support\AttachmentCollection;
/**
* Class MultipleHtmlPartsAndAttachmentsTest
*
* @package Tests\fixtures
*/
class MultipleHtmlPartsAndAttachmentsTest extends FixtureTestCase {
/**
* Test the fixture multiple_html_parts_and_attachments.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("multiple_html_parts_and_attachments.eml");
self::assertEquals("multiple_html_parts_and_attachments", $message->subject);
self::assertEquals("This is the first html part\r\n\r\n\r\n\r\nThis is the second html part\r\n\r\n\r\n\r\nThis is the last html part\r\nhttps://www.there.com", $message->getTextBody());
self::assertEquals("<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=us-ascii\"></head><body style=\"overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;\">This is the <b>first</b> html <u>part</u><br><br></body></html>\n<html><body style=\"overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;\"><head><meta http-equiv=\"content-type\" content=\"text/html; charset=us-ascii\"></head><br><br>This is <strike>the</strike> second html <i>part</i><br><br></body></html>\n<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=us-ascii\"></head><body style=\"overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;\"><br><br><font size=\"2\"><i>This</i> is the last <b>html</b> part</font><div>https://www.there.com</div><div><br></div><br><br>\r\n<br></body></html>", $message->getHTMLBody());
self::assertEquals("2023-02-16 09:19:02", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
$from = $message->from->first();
self::assertEquals("FromName", $from->personal);
self::assertEquals("from", $from->mailbox);
self::assertEquals("there.com", $from->host);
self::assertEquals("from@there.com", $from->mail);
self::assertEquals("FromName <from@there.com>", $from->full);
self::assertEquals("to@there.com", $message->to->first());
$attachments = $message->attachments();
self::assertInstanceOf(AttachmentCollection::class, $attachments);
self::assertCount(2, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("attachment1.pdf", $attachment->name);
self::assertEquals('pdf', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("application/pdf", $attachment->content_type);
self::assertEquals("c162adf19e0f67e26ef0b7f791b33a60b2c23b175560a505dc7f9ec490206e49", hash("sha256", $attachment->content));
self::assertEquals(4814, $attachment->size);
self::assertEquals(4, $attachment->part_number);
self::assertEquals("inline", $attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[1];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("attachment2.pdf", $attachment->name);
self::assertEquals('pdf', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("application/pdf", $attachment->content_type);
self::assertEquals("a337b37e9d3edb172a249639919f0eee3d344db352046d15f8f9887e55855a25", hash("sha256", $attachment->content));
self::assertEquals(5090, $attachment->size);
self::assertEquals(6, $attachment->part_number);
self::assertEquals("inline", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,69 @@
<?php
/*
* File: MultipleNestedAttachmentsTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
use Webklex\PHPIMAP\Support\AttachmentCollection;
/**
* Class MultipleNestedAttachmentsTest
*
* @package Tests\fixtures
*/
class MultipleNestedAttachmentsTest extends FixtureTestCase {
/**
* Test the fixture multiple_nested_attachments.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("multiple_nested_attachments.eml");
self::assertEquals("", $message->subject);
self::assertEquals("------------------------------------------------------------------------", $message->getTextBody());
self::assertEquals("<html>\r\n <head>\r\n\r\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n </head>\r\n <body text=\"#000000\" bgcolor=\"#FFFFFF\">\r\n <p><br>\r\n </p>\r\n <div class=\"moz-signature\">\r\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n <title></title>\r\n  <img src=\"cid:part1.8B953FBA.0E5A242C@xyz.xyz\" alt=\"\">\r\n <hr>\r\n <table width=\"20\" cellspacing=\"2\" cellpadding=\"2\" height=\"31\">\r\n <tbody>\r\n <tr>\r\n <td><br>\r\n </td>\r\n <td valign=\"middle\"><br>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n </body>\r\n</html>", $message->getHTMLBody());
self::assertEquals("2018-01-15 09:54:09", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertFalse($message->from->first());
self::assertFalse($message->to->first());
$attachments = $message->attachments();
self::assertInstanceOf(AttachmentCollection::class, $attachments);
self::assertCount(2, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("mleokdgdlgkkecep.png", $attachment->name);
self::assertEquals('png', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("image/png", $attachment->content_type);
self::assertEquals("e0e99b0bd6d5ea3ced99add53cc98b6f8eea6eae8ddd773fd06f3489289385fb", hash("sha256", $attachment->content));
self::assertEquals(114, $attachment->size);
self::assertEquals(5, $attachment->part_number);
self::assertEquals("inline", $attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[1];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("FF4D00-1.png", $attachment->name);
self::assertEquals('png', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("image/png", $attachment->content_type);
self::assertEquals("e0e99b0bd6d5ea3ced99add53cc98b6f8eea6eae8ddd773fd06f3489289385fb", hash("sha256", $attachment->content));
self::assertEquals(114, $attachment->size);
self::assertEquals(8, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,69 @@
<?php
/*
* File: NestesEmbeddedWithAttachmentTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
use Webklex\PHPIMAP\Support\AttachmentCollection;
/**
* Class NestesEmbeddedWithAttachmentTest
*
* @package Tests\fixtures
*/
class NestesEmbeddedWithAttachmentTest extends FixtureTestCase {
/**
* Test the fixture nestes_embedded_with_attachment.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("nestes_embedded_with_attachment.eml");
self::assertEquals("Nuu", $message->subject);
self::assertEquals("Dear Sarah", $message->getTextBody());
self::assertEquals("<HTML><HEAD></HEAD>\r\n<BODY dir=ltr>\r\n<DIV>Dear Sarah,</DIV>\r\n</BODY></HTML>", $message->getHTMLBody());
self::assertEquals("2017-09-13 11:05:45", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
$attachments = $message->attachments();
self::assertInstanceOf(AttachmentCollection::class, $attachments);
self::assertCount(2, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("first.eml", $attachment->name);
self::assertEquals('eml', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("message/rfc822", $attachment->content_type);
self::assertEquals("From: from@there.com\r\nTo: to@here.com\r\nSubject: FIRST\r\nDate: Sat, 28 Apr 2018 14:37:16 -0400\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed;\r\n boundary=\"----=_NextPart_000_222_000\"\r\n\r\nThis is a multi-part message in MIME format.\r\n\r\n------=_NextPart_000_222_000\r\nContent-Type: multipart/alternative;\r\n boundary=\"----=_NextPart_000_222_111\"\r\n\r\n\r\n------=_NextPart_000_222_111\r\nContent-Type: text/plain;\r\n charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\nPlease respond directly to this email to update your RMA\r\n\r\n\r\n2018-04-17T11:04:03-04:00\r\n------=_NextPart_000_222_111\r\nContent-Type: text/html;\r\n charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n<HTML><HEAD></HEAD>\r\n<BODY dir=3Dltr>\r\n<DIV>Please respond directly to this =\r\nemail to=20\r\nupdate your RMA</DIV></BODY></HTML>\r\n\r\n------=_NextPart_000_222_111--\r\n\r\n------=_NextPart_000_222_000\r\nContent-Type: image/png;\r\n name=\"chrome.png\"\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment;\r\n filename=\"chrome.png\"\r\n\r\niVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAB+FBMVEUAAAA/mUPidDHiLi5Cn0Xk\r\nNTPmeUrkdUg/m0Q0pEfcpSbwaVdKskg+lUP4zA/iLi3msSHkOjVAmETdJSjtYFE/lkPnRj3sWUs8\r\nkkLeqCVIq0fxvhXqUkbVmSjwa1n1yBLepyX1xxP0xRXqUkboST9KukpHpUbuvRrzrhF/ljbwalju\r\nZFM4jELaoSdLtElJrUj1xxP6zwzfqSU4i0HYnydMtUlIqUfywxb60AxZqEXaoifgMCXptR9MtklH\r\npEY2iUHWnSjvvRr70QujkC+pUC/90glMuEnlOjVMt0j70QriLS1LtEnnRj3qUUXfIidOjsxAhcZF\r\no0bjNDH0xxNLr0dIrUdmntVTkMoyfL8jcLBRuErhJyrgKyb4zA/5zg3tYFBBmUTmQTnhMinruBzv\r\nvhnxwxZ/st+Ktt5zp9hqota2vtK6y9FemNBblc9HiMiTtMbFtsM6gcPV2r6dwroseLrMrbQrdLGd\r\nyKoobKbo3Zh+ynrgVllZulTsXE3rV0pIqUf42UVUo0JyjEHoS0HmsiHRGR/lmRz/1hjqnxjvpRWf\r\nwtOhusaz0LRGf7FEfbDVmqHXlJeW0pbXq5bec3fX0nTnzmuJuWvhoFFhm0FtrziBsjaAaDCYWC+u\r\nSi6jQS3FsSfLJiTirCOkuCG1KiG+wSC+GBvgyhTszQ64Z77KAAAARXRSTlMAIQRDLyUgCwsE6ebm\r\n5ubg2dLR0byXl4FDQzU1NDEuLSUgC+vr6urq6ubb29vb2tra2tG8vLu7u7uXl5eXgYGBgYGBLiUA\r\nLabIAAABsElEQVQoz12S9VPjQBxHt8VaOA6HE+AOzv1wd7pJk5I2adpCC7RUcHd3d3fXf5PvLkxh\r\neD++z+yb7GSRlwD/+Hj/APQCZWxM5M+goF+RMbHK594v+tPoiN1uHxkt+xzt9+R9wnRTZZQpXQ0T\r\n5uP1IQxToyOAZiQu5HEpjeA4SWIoksRxNiGC1tRZJ4LNxgHgnU5nJZBDvuDdl8lzQRBsQ+s9PZt7\r\ns7Pz8wsL39/DkIfZ4xlB2Gqsq62ta9oxVlVrNZpihFRpGO9fzQw1ms0NDWZz07iGkJmIFH8xxkc3\r\na/WWlubmFkv9AB2SEpDvKxbjidN2faseaNV3zoHXvv7wMODJdkOHAegweAfFPx4G67KluxzottCU\r\n9n8CUqXzcIQdXOytAHqXxomvykhEKN9EFutG22p//0rbNvHVxiJywa8yS2KDfV1dfbu31H8jF1RH\r\niTKtWYeHxUvq3bn0pyjCRaiRU6aDO+gb3aEfEeVNsDgm8zzLy9egPa7Qt8TSJdwhjplk06HH43ZN\r\nJ3s91KKCHQ5x4sw1fRGYDZ0n1L4FKb9/BP5JLYxToheoFCVxz57PPS8UhhEpLBVeAAAAAElFTkSu\r\nQmCC\r\n\r\n------=_NextPart_000_222_000--", $attachment->content);
self::assertEquals(2535, $attachment->size);
self::assertEquals(5, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[1];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("second.eml", $attachment->name);
self::assertEquals('eml', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("message/rfc822", $attachment->content_type);
self::assertEquals("From: from@there.com\r\nTo: to@here.com\r\nSubject: SECOND\r\nDate: Sat, 28 Apr 2018 13:37:30 -0400\r\nMIME-Version: 1.0\r\nContent-Type: multipart/alternative;\r\n boundary=\"----=_NextPart_000_333_000\"\r\n\r\nThis is a multi-part message in MIME format.\r\n\r\n------=_NextPart_000_333_000\r\nContent-Type: text/plain;\r\n charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\nT whom it may concern:\r\n------=_NextPart_000_333_000\r\nContent-Type: text/html;\r\n charset=\"UTF-8\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n<HTML><HEAD></HEAD>\r\n<BODY dir=3Dltr>\r\n<DIV>T whom it may concern:</DIV>\r\n</BODY></HTML>\r\n\r\n------=_NextPart_000_333_000--", $attachment->content);
self::assertEquals(631, $attachment->size);
self::assertEquals(6, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* File: NullContentCharsetTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class NullContentCharsetTest
*
* @package Tests\fixtures
*/
class NullContentCharsetTest extends FixtureTestCase {
/**
* Test the fixture null_content_charset.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("null_content_charset.eml");
self::assertEquals("test", $message->getSubject());
self::assertEquals("Hi!", $message->getTextBody());
self::assertEquals("1.0", $message->mime_version);
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-27 10:48:51", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
}
}

View File

@@ -0,0 +1,82 @@
<?php
/*
* File: PecTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
use Webklex\PHPIMAP\Support\AttachmentCollection;
/**
* Class PecTest
*
* @package Tests\fixtures
*/
class PecTest extends FixtureTestCase {
/**
* Test the fixture pec.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("pec.eml");
self::assertEquals("Certified", $message->subject);
self::assertEquals("Signed", $message->getTextBody());
self::assertEquals("<html><body>Signed</body></html>", $message->getHTMLBody());
self::assertEquals("2017-10-02 10:13:43", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("test@example.com", $message->from->first()->mail);
self::assertEquals("test@example.com", $message->to->first()->mail);
$attachments = $message->attachments();
self::assertInstanceOf(AttachmentCollection::class, $attachments);
self::assertCount(3, $attachments);
$attachment = $attachments[0];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("data.xml", $attachment->name);
self::assertEquals('xml', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("application/xml", $attachment->content_type);
self::assertEquals("<xml/>", $attachment->content);
self::assertEquals(8, $attachment->size);
self::assertEquals(4, $attachment->part_number);
self::assertEquals("inline", $attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[1];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("postacert.eml", $attachment->name);
self::assertEquals('eml', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("message/rfc822", $attachment->content_type);
self::assertEquals("To: test@example.com\r\nFrom: test@example.com\r\nSubject: test-subject\r\nDate: Mon, 2 Oct 2017 12:13:50 +0200\r\nContent-Type: text/plain; charset=iso-8859-15; format=flowed\r\nContent-Transfer-Encoding: 7bit\r\n\r\ntest-content", $attachment->content);
self::assertEquals(216, $attachment->size);
self::assertEquals(5, $attachment->part_number);
self::assertEquals("inline", $attachment->disposition);
self::assertNotEmpty($attachment->id);
$attachment = $attachments[2];
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("smime.p7s", $attachment->name);
self::assertEquals('p7s', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("application/x-pkcs7-signature", $attachment->content_type);
self::assertEquals("1", $attachment->content);
self::assertEquals(4, $attachment->size);
self::assertEquals(7, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* File: PlainOnlyTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class PlainOnlyTest
*
* @package Tests\fixtures
*/
class PlainOnlyTest extends FixtureTestCase {
/**
* Test the fixture plain_only.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("plain_only.eml");
self::assertEquals("Nuu", $message->getSubject());
self::assertEquals("Hi", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-13 11:05:45", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
}
}

View File

@@ -0,0 +1,54 @@
<?php
/*
* File: PlainTextAttachmentTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
/**
* Class PlainTextAttachmentTest
*
* @package Tests\fixtures
*/
class PlainTextAttachmentTest extends FixtureTestCase {
/**
* Test the fixture plain_text_attachment.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("plain_text_attachment.eml");
self::assertEquals("Plain text attachment", $message->subject);
self::assertEquals("Test", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2018-08-21 07:05:14", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
self::assertCount(1, $message->attachments());
$attachment = $message->attachments()->first();
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("a.txt", $attachment->name);
self::assertEquals('txt', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertNull($attachment->content_type);
self::assertEquals("Hi!", $attachment->content);
self::assertEquals(4, $attachment->size);
self::assertEquals(2, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,54 @@
<?php
/*
* File: ReferencesTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class ReferencesTest
*
* @package Tests\fixtures
*/
class ReferencesTest extends FixtureTestCase {
/**
* Test the fixture references.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("references.eml");
self::assertEquals("", $message->subject);
self::assertEquals("Hi\r\nHow are you?", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertFalse($message->date->first());
self::assertEquals("b9e87bd5e661a645ed6e3b832828fcc5@example.com", $message->in_reply_to);
self::assertEquals("", $message->from->first()->personal);
self::assertEquals("UNKNOWN", $message->from->first()->host);
self::assertEquals("no_host@UNKNOWN", $message->from->first()->mail);
self::assertFalse($message->to->first());
self::assertEquals([
"231d9ac57aec7d8c1a0eacfeab8af6f3@example.com",
"08F04024-A5B3-4FDE-BF2C-6710DE97D8D9@example.com"
], $message->getReferences()->all());
self::assertEquals([
'This one: is "right" <ding@dong.com>',
'No-address@UNKNOWN'
], $message->cc->map(function($address){
/** @var \Webklex\PHPIMAP\Address $address */
return $address->full;
}));
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* File: SimpleMultipartTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class SimpleMultipartTest
*
* @package Tests\fixtures
*/
class SimpleMultipartTest extends FixtureTestCase {
/**
* Test the fixture simple_multipart.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("simple_multipart.eml");
self::assertEquals("test", $message->getSubject());
self::assertEquals("MyPlain", $message->getTextBody());
self::assertEquals("MyHtml", $message->getHTMLBody());
self::assertEquals("2017-09-27 10:48:51", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
}
}

View File

@@ -0,0 +1,55 @@
<?php
/*
* File: StructuredWithAttachmentTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Attachment;
use Webklex\PHPIMAP\IMAP;
/**
* Class StructuredWithAttachmentTest
*
* @package Tests\fixtures
*/
class StructuredWithAttachmentTest extends FixtureTestCase {
/**
* Test the fixture structured_with_attachment.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("structured_with_attachment.eml");
self::assertEquals("Test", $message->getSubject());
self::assertEquals("Test", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-29 08:55:23", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
self::assertCount(1, $message->attachments());
$attachment = $message->attachments()->first();
self::assertInstanceOf(Attachment::class, $attachment);
self::assertEquals("MyFile.txt", $attachment->name);
self::assertEquals('txt', $attachment->getExtension());
self::assertEquals('text', $attachment->type);
self::assertEquals("text/plain", $attachment->content_type);
self::assertEquals("MyFileContent", $attachment->content);
self::assertEquals(20, $attachment->size);
self::assertEquals(2, $attachment->part_number);
self::assertEquals("attachment", $attachment->disposition);
self::assertNotEmpty($attachment->id);
}
}

View File

@@ -0,0 +1,59 @@
<?php
/*
* File: UndefinedCharsetHeaderTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
use Webklex\PHPIMAP\Address;
/**
* Class UndefinedCharsetHeaderTest
*
* @package Tests\fixtures
*/
class UndefinedCharsetHeaderTest extends FixtureTestCase {
/**
* Test the fixture undefined_charset_header.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("undefined_charset_header.eml");
self::assertEquals("<monitor@bla.bla>", $message->get("x-real-to"));
self::assertEquals("1.0", $message->get("mime-version"));
self::assertEquals("Mon, 27 Feb 2017 13:21:44 +0930", $message->get("Resent-Date"));
self::assertEquals("<postmaster@bla.bla>", $message->get("Resent-From"));
self::assertEquals("BlaBla", $message->get("X-Stored-In"));
self::assertEquals("<info@bla.bla>", $message->get("Return-Path"));
self::assertEquals([
'from <postmaster@bla.bla> by bla.bla (CommuniGate Pro RULE 6.1.13) with RULE id 14057804; Mon, 27 Feb 2017 13:21:44 +0930',
'from <postmaster@bla.bla> by bla.bla (CommuniGate Pro RULE 6.1.13) with RULE id 14057804'
], $message->get("Received")->all());
self::assertEquals(")", $message->getHTMLBody());
self::assertFalse($message->hasTextBody());
self::assertEquals("2017-02-27 03:51:29", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
$from = $message->from->first();
self::assertInstanceOf(Address::class, $from);
self::assertEquals("myGov", $from->personal);
self::assertEquals("info", $from->mailbox);
self::assertEquals("bla.bla", $from->host);
self::assertEquals("info@bla.bla", $from->mail);
self::assertEquals("myGov <info@bla.bla>", $from->full);
self::assertEquals("sales@bla.bla", $message->to->first()->mail);
self::assertEquals("Submit your tax refund | Australian Taxation Office.", $message->subject);
self::assertEquals("201702270351.BGF77614@bla.bla", $message->message_id);
}
}

View File

@@ -0,0 +1,42 @@
<?php
/*
* File: PlainOnlyTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class PlainOnlyTest
*
* @package Tests\fixtures
*/
class UndisclosedRecipientsMinusTest extends FixtureTestCase {
/**
* Test the fixture undisclosed_recipients_minus.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("undisclosed_recipients_minus.eml");
self::assertEquals("test", $message->subject);
self::assertEquals("Hi!", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-27 10:48:51", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from);
self::assertEquals([
"undisclosed-recipients",
""
], $message->to->map(function ($item) {
return $item->mailbox;
}));
}
}

View File

@@ -0,0 +1,42 @@
<?php
/*
* File: UndisclosedRecipientsSpaceTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class UndisclosedRecipientsSpaceTest
*
* @package Tests\fixtures
*/
class UndisclosedRecipientsSpaceTest extends FixtureTestCase {
/**
* Test the fixture undisclosed_recipients_space.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("undisclosed_recipients_space.eml");
self::assertEquals("test", $message->subject);
self::assertEquals("Hi!", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-27 10:48:51", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from);
self::assertEquals([
"Undisclosed recipients",
""
], $message->to->map(function ($item) {
return $item->mailbox;
}));
}
}

View File

@@ -0,0 +1,42 @@
<?php
/*
* File: UndisclosedRecipientsTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class UndisclosedRecipientsTest
*
* @package Tests\fixtures
*/
class UndisclosedRecipientsTest extends FixtureTestCase {
/**
* Test the fixture undisclosed_recipients.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("undisclosed_recipients.eml");
self::assertEquals("test", $message->subject);
self::assertEquals("Hi!", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-27 10:48:51", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from);
self::assertEquals([
"Undisclosed Recipients",
""
], $message->to->map(function ($item) {
return $item->mailbox;
}));
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* File: UnknownEncodingTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class UnknownEncodingTest
*
* @package Tests\fixtures
*/
class UnknownEncodingTest extends FixtureTestCase {
/**
* Test the fixture unknown_encoding.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("unknown_encoding.eml");
self::assertEquals("test", $message->getSubject());
self::assertEquals("MyPlain", $message->getTextBody());
self::assertEquals("MyHtml", $message->getHTMLBody());
self::assertEquals("2017-09-27 10:48:51", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* File: WithoutCharsetPlainOnlyTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class WithoutCharsetPlainOnlyTest
*
* @package Tests\fixtures
*/
class WithoutCharsetPlainOnlyTest extends FixtureTestCase {
/**
* Test the fixture without_charset_plain_only.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("without_charset_plain_only.eml");
self::assertEquals("Nuu", $message->getSubject());
self::assertEquals("Hi", $message->getTextBody());
self::assertFalse($message->hasHTMLBody());
self::assertEquals("2017-09-13 11:05:45", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/*
* File: WithoutCharsetSimpleMultipartTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 09.03.23 02:24
* Updated: -
*
* Description:
* -
*/
namespace Tests\fixtures;
/**
* Class WithoutCharsetSimpleMultipartTest
*
* @package Tests\fixtures
*/
class WithoutCharsetSimpleMultipartTest extends FixtureTestCase {
/**
* Test the fixture without_charset_simple_multipart.eml
*
* @return void
*/
public function testFixture() : void {
$message = $this->getFixture("without_charset_simple_multipart.eml");
self::assertEquals("test", $message->getSubject());
self::assertEquals("MyPlain", $message->getTextBody());
self::assertEquals("MyHtml", $message->getHTMLBody());
self::assertEquals("2017-09-27 10:48:51", $message->date->first()->setTimezone('UTC')->format("Y-m-d H:i:s"));
self::assertEquals("from@there.com", $message->from->first()->mail);
self::assertEquals("to@here.com", $message->to->first()->mail);
}
}

View File

@@ -0,0 +1,38 @@
<?php
/*
* File: Issue355Test.php
* Category: -
* Author: M.Goldenbaum
* Created: 10.01.23 10:48
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Message;
class Issue275Test extends TestCase {
public function testIssueEmail1() {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-275.eml"]);
$message = Message::fromFile($filename);
self::assertSame("Testing 123", (string)$message->subject);
self::assertSame("Asdf testing123 this is a body", $message->getTextBody());
}
public function testIssueEmail2() {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-275-2.eml"]);
$message = Message::fromFile($filename);
$body = "Test\r\n\r\nMed venlig hilsen\r\nMartin Larsen\r\nFeline Holidays A/S\r\nTlf 78 77 04 12";
self::assertSame("Test 1017", (string)$message->subject);
self::assertSame($body, $message->getTextBody());
}
}

View File

@@ -0,0 +1,30 @@
<?php
/*
* File: Issue355Test.php
* Category: -
* Author: M.Goldenbaum
* Created: 10.01.23 10:48
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Header;
class Issue355Test extends TestCase {
public function testIssue() {
$raw_header = "Subject: =?UTF-8?Q?Re=3A_Uppdaterat_=C3=A4rende_=28447899=29=2C_kostnader_f=C3=B6r_hj=C3=A4?= =?UTF-8?Q?lp_med_stadge=C3=A4ndring_enligt_ny_lagstiftning?=\r\n";
$header = new Header($raw_header, Config::make());
$subject = $header->get("subject");
$this->assertEquals("Re: Uppdaterat ärende (447899), kostnader för hjälp med stadgeändring enligt ny lagstiftning", $subject->toString());
}
}

View File

@@ -0,0 +1,61 @@
<?php
/*
* File: Issue355Test.php
* Category: -
* Author: M.Goldenbaum
* Created: 10.01.23 10:48
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use Tests\live\LiveMailboxTestCase;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\MessageContentFetchingException;
use Webklex\PHPIMAP\Exceptions\MessageFlagException;
use Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException;
use Webklex\PHPIMAP\Exceptions\MessageNotFoundException;
use Webklex\PHPIMAP\Exceptions\ResponseException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
class Issue379Test extends LiveMailboxTestCase {
/**
* Test issue #379 - Message::getSize() added
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MessageContentFetchingException
* @throws MessageFlagException
* @throws MessageHeaderFetchingException
* @throws MessageNotFoundException
* @throws ResponseException
* @throws RuntimeException
* @throws MaskNotFoundException
*/
public function testIssue(): void {
$folder = $this->getFolder('INBOX');
$message = $this->appendMessageTemplate($folder, "plain.eml");
$this->assertEquals(214, $message->getSize());
// Clean up
$this->assertTrue($message->delete(true));
}
}

View File

@@ -0,0 +1,33 @@
<?php
/*
* File: Issue382Test.php
* Category: Test
* Author: M.Goldenbaum
* Created: 24.06.23 00:41
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Message;
class Issue382Test extends TestCase {
public function testIssueEmail() {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-382.eml"]);
$message = Message::fromFile($filename);
$from = $message->from->first();
self::assertSame("Mail Delivery System", $from->personal);
self::assertSame("MAILER-DAEMON", $from->mailbox);
self::assertSame("mta-09.someserver.com", $from->host);
self::assertSame("MAILER-DAEMON@mta-09.someserver.com", $from->mail);
self::assertSame("Mail Delivery System <MAILER-DAEMON@mta-09.someserver.com>", $from->full);
}
}

View File

@@ -0,0 +1,69 @@
<?php
/*
* File: Issue355Test.php
* Category: -
* Author: M.Goldenbaum
* Created: 10.01.23 10:48
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use Tests\live\LiveMailboxTestCase;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\ResponseException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
use Webklex\PHPIMAP\Folder;
class Issue383Test extends LiveMailboxTestCase {
/**
* Test issue #383 - Does not work when a folder name contains umlauts: Entwürfe
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws ResponseException
* @throws RuntimeException
* @throws MaskNotFoundException
*/
public function testIssue(): void {
$client = $this->getClient();
$client->connect();
$delimiter = $this->getManager()->getConfig()->get("options.delimiter");
$folder_path = implode($delimiter, ['INBOX', 'Entwürfe+']);
$folder = $client->getFolder($folder_path);
$this->deleteFolder($folder);
$folder = $client->createFolder($folder_path, false);
self::assertInstanceOf(Folder::class, $folder);
$folder = $this->getFolder($folder_path);
self::assertInstanceOf(Folder::class, $folder);
$this->assertEquals('Entwürfe+', $folder->name);
$this->assertEquals($folder_path, $folder->full_name);
$folder_path = implode($delimiter, ['INBOX', 'Entw&APw-rfe+']);
$this->assertEquals($folder_path, $folder->path);
// Clean up
if ($this->deleteFolder($folder) === false) {
$this->fail("Could not delete folder: " . $folder->path);
}
}
}

View File

@@ -0,0 +1,62 @@
<?php
/*
* File: Issue393Test.php
* Category: -
* Author: M.Goldenbaum
* Created: 10.01.23 10:48
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use Tests\live\LiveMailboxTestCase;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\ResponseException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
use Webklex\PHPIMAP\Folder;
class Issue393Test extends LiveMailboxTestCase {
/**
* Test issue #393 - "Empty response" when calling getFolders()
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws ResponseException
* @throws RuntimeException
* @throws MaskNotFoundException
*/
public function testIssue(): void {
$client = $this->getClient();
$client->connect();
$delimiter = $this->getManager()->getConfig()->get("options.delimiter");
$pattern = implode($delimiter, ['doesnt_exist', '%']);
$folder = $client->getFolder('doesnt_exist');
$this->deleteFolder($folder);
$folders = $client->getFolders(true, $pattern, true);
self::assertCount(0, $folders);
try {
$client->getFolders(true, $pattern, false);
$this->fail('Expected FolderFetchingException::class exception not thrown');
} catch (FolderFetchingException $e) {
self::assertInstanceOf(FolderFetchingException::class, $e);
}
}
}

View File

@@ -0,0 +1,27 @@
<?php
/*
* File: Issue401Test.php
* Category: Test
* Author: M.Goldenbaum
* Created: 23.06.23 22:48
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Message;
class Issue401Test extends TestCase {
public function testIssueEmail() {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-401.eml"]);
$message = Message::fromFile($filename);
self::assertSame("1;00pm Client running few minutes late", (string)$message->subject);
}
}

View File

@@ -0,0 +1,57 @@
<?php
/*
* File: Issue407Test.php
* Category: Test
* Author: M.Goldenbaum
* Created: 23.06.23 21:40
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use PHPUnit\Framework\TestCase;
use Tests\live\LiveMailboxTestCase;
use Webklex\PHPIMAP\Folder;
use Webklex\PHPIMAP\IMAP;
use Webklex\PHPIMAP\Message;
class Issue407Test extends LiveMailboxTestCase {
/**
* @return void
* @throws \Webklex\PHPIMAP\Exceptions\AuthFailedException
* @throws \Webklex\PHPIMAP\Exceptions\ConnectionFailedException
* @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
* @throws \Webklex\PHPIMAP\Exceptions\FolderFetchingException
* @throws \Webklex\PHPIMAP\Exceptions\ImapBadRequestException
* @throws \Webklex\PHPIMAP\Exceptions\ImapServerErrorException
* @throws \Webklex\PHPIMAP\Exceptions\InvalidMessageDateException
* @throws \Webklex\PHPIMAP\Exceptions\MaskNotFoundException
* @throws \Webklex\PHPIMAP\Exceptions\MessageContentFetchingException
* @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
* @throws \Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException
* @throws \Webklex\PHPIMAP\Exceptions\ResponseException
* @throws \Webklex\PHPIMAP\Exceptions\RuntimeException
*/
public function testIssue() {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$message = $this->appendMessageTemplate($folder, "plain.eml");
self::assertInstanceOf(Message::class, $message);
$message->setFlag("Seen");
$flags = $this->getClient()->getConnection()->flags($message->uid, IMAP::ST_UID)->validatedData();
self::assertIsArray($flags);
self::assertSame(1, count($flags));
self::assertSame("\\Seen", $flags[$message->uid][0]);
$message->delete();
}
}

View File

@@ -0,0 +1,52 @@
<?php
/*
* File: Issue410Test.php
* Category: -
* Author: M.Goldenbaum
* Created: 23.06.23 20:41
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\Message;
class Issue410Test extends TestCase {
public function testIssueEmail() {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-410.eml"]);
$message = Message::fromFile($filename);
self::assertSame("☆第132号 「ガーデン&エクステリア」専門店のためのQ&Aサロン 【月刊エクステリア・ワーク】", (string)$message->subject);
$attachments = $message->getAttachments();
self::assertSame(1, $attachments->count());
$attachment = $attachments->first();
self::assertSame("☆第132号 「ガーデン&エクステリア」専門店のためのQ&Aサロン 【月刊エクステリア・ワーク】", $attachment->filename);
self::assertSame("☆第132号 「ガーデン&エクステリア」専門店のためのQ&Aサロン 【月刊エクステリア・ワーク】", $attachment->name);
}
public function testIssueEmailB() {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-410b.eml"]);
$message = Message::fromFile($filename);
self::assertSame("386 - 400021804 - 19., Heiligenstädter Straße 80 - 0819306 - Anfrage Vergabevorschlag", (string)$message->subject);
$attachments = $message->getAttachments();
self::assertSame(1, $attachments->count());
$attachment = $attachments->first();
self::assertSame("2021_Mängelliste_0819306.xlsx", $attachment->description);
self::assertSame("2021_Mängelliste_0819306.xlsx", $attachment->filename);
self::assertSame("2021_Mängelliste_0819306.xlsx", $attachment->name);
}
}

View File

@@ -0,0 +1,31 @@
<?php
/*
* File: Issue413Test.php
* Category: Test
* Author: M.Goldenbaum
* Created: 23.06.23 21:09
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Message;
class Issue412Test extends TestCase {
public function testIssueEmail() {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-412.eml"]);
$message = Message::fromFile($filename);
self::assertSame("RE: TEST MESSAGE", (string)$message->subject);
self::assertSame("64254d63e92a36ee02c760676351e60a", md5($message->getTextBody()));
self::assertSame("2e4de288f6a1ed658548ed11fcdb1d79", md5($message->getHTMLBody()));
self::assertSame(0, $message->attachments()->count());
}
}

View File

@@ -0,0 +1,82 @@
<?php
/*
* File: Issue413Test.php
* Category: Test
* Author: M.Goldenbaum
* Created: 23.06.23 21:09
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use PHPUnit\Framework\TestCase;
use Tests\live\LiveMailboxTestCase;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Folder;
use Webklex\PHPIMAP\Message;
class Issue413Test extends LiveMailboxTestCase {
/**
* Live server test
*
* @return void
* @throws \Webklex\PHPIMAP\Exceptions\AuthFailedException
* @throws \Webklex\PHPIMAP\Exceptions\ConnectionFailedException
* @throws \Webklex\PHPIMAP\Exceptions\EventNotFoundException
* @throws \Webklex\PHPIMAP\Exceptions\FolderFetchingException
* @throws \Webklex\PHPIMAP\Exceptions\GetMessagesFailedException
* @throws \Webklex\PHPIMAP\Exceptions\ImapBadRequestException
* @throws \Webklex\PHPIMAP\Exceptions\ImapServerErrorException
* @throws \Webklex\PHPIMAP\Exceptions\InvalidMessageDateException
* @throws \Webklex\PHPIMAP\Exceptions\MaskNotFoundException
* @throws \Webklex\PHPIMAP\Exceptions\MessageContentFetchingException
* @throws \Webklex\PHPIMAP\Exceptions\MessageFlagException
* @throws \Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException
* @throws \Webklex\PHPIMAP\Exceptions\MessageNotFoundException
* @throws \Webklex\PHPIMAP\Exceptions\ResponseException
* @throws \Webklex\PHPIMAP\Exceptions\RuntimeException
*/
public function testLiveIssueEmail() {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
/** @var Message $message */
$_message = $this->appendMessageTemplate($folder, 'issue-413.eml');
$message = $folder->messages()->getMessageByMsgn($_message->msgn);
self::assertEquals($message->uid, $_message->uid);
self::assertSame("Test Message", (string)$message->subject);
self::assertSame("This is just a test, so ignore it (if you can!)\r\n\r\nTony Marston", $message->getTextBody());
$message->delete();
}
/**
* Static parsing test
*
* @return void
* @throws \ReflectionException
* @throws \Webklex\PHPIMAP\Exceptions\AuthFailedException
* @throws \Webklex\PHPIMAP\Exceptions\ConnectionFailedException
* @throws \Webklex\PHPIMAP\Exceptions\ImapBadRequestException
* @throws \Webklex\PHPIMAP\Exceptions\ImapServerErrorException
* @throws \Webklex\PHPIMAP\Exceptions\InvalidMessageDateException
* @throws \Webklex\PHPIMAP\Exceptions\MaskNotFoundException
* @throws \Webklex\PHPIMAP\Exceptions\MessageContentFetchingException
* @throws \Webklex\PHPIMAP\Exceptions\ResponseException
* @throws \Webklex\PHPIMAP\Exceptions\RuntimeException
*/
public function testIssueEmail() {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-413.eml"]);
$message = Message::fromFile($filename);
self::assertSame("Test Message", (string)$message->subject);
self::assertSame("This is just a test, so ignore it (if you can!)\r\n\r\nTony Marston", $message->getTextBody());
}
}

View File

@@ -0,0 +1,43 @@
<?php
/*
* File: Issue410Test.php
* Category: -
* Author: M.Goldenbaum
* Created: 23.06.23 20:41
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Message;
class Issue414Test extends TestCase {
public function testIssueEmail() {
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-414.eml"]);
$message = Message::fromFile($filename);
self::assertSame("Test", (string)$message->subject);
$attachments = $message->getAttachments();
self::assertSame(2, $attachments->count());
$attachment = $attachments->first();
self::assertEmpty($attachment->description);
self::assertSame("exampleMyFile.txt", $attachment->filename);
self::assertSame("exampleMyFile.txt", $attachment->name);
self::assertSame("be62f7e6", $attachment->id);
$attachment = $attachments->last();
self::assertEmpty($attachment->description);
self::assertSame("phpfoo", $attachment->filename);
self::assertSame("phpfoo", $attachment->name);
self::assertSame("12e1d38b", $attachment->hash);
}
}

View File

@@ -0,0 +1,31 @@
<?php
/*
* File: Issue355Test.php
* Category: -
* Author: M.Goldenbaum
* Created: 10.01.23 10:48
* Updated: -
*
* Description:
* -
*/
namespace Tests\issues;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Config;
use Webklex\PHPIMAP\Header;
class Issue420Test extends TestCase {
public function testIssue() {
$raw_header = "Subject: =?UTF-8?B?VGlja2V0IE5vOiBb7aC97bOpMTddIE1haWxib3ggSW5ib3ggLSAoMTcpIEluY29taW5nIGZhaWxlZCBtZXNzYWdlcw==?=\r\n";
$header = new Header($raw_header, Config::make());
$subject = $header->get("subject");
// Ticket No: [<5B><>17] Mailbox Inbox - (17) Incoming failed messages
$this->assertEquals('Ticket No: [??17] Mailbox Inbox - (17) Incoming failed messages', utf8_decode($subject->toString()));
}
}

View File

@@ -0,0 +1,318 @@
<?php
/*
* File: ClientTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 04.03.23 03:52
* Updated: -
*
* Description:
* -
*/
namespace Tests\live;
use Webklex\PHPIMAP\Client;
use Webklex\PHPIMAP\Connection\Protocols\ProtocolInterface;
use Webklex\PHPIMAP\EncodingAliases;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\ResponseException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
use Webklex\PHPIMAP\Folder;
use Webklex\PHPIMAP\Support\Masks\AttachmentMask;
use Webklex\PHPIMAP\Support\Masks\MessageMask;
/**
* Class ClientTest
*
* @package Tests
*/
class ClientTest extends LiveMailboxTestCase {
/**
* Test if the connection is working
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws ResponseException
* @throws RuntimeException
* @throws MaskNotFoundException
*/
public function testConnect(): void {
self::assertNotNull($this->getClient()->connect());
}
/**
* Test if the connection is working
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testIsConnected(): void {
$client = $this->getClient()->connect();
self::assertTrue($client->isConnected());
}
/**
* Test if the connection state can be determined
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testDisconnect(): void {
$client = $this->getClient()->connect();
self::assertFalse($client->disconnect()->isConnected());
}
/**
* Test to get the default inbox folder
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
* @throws FolderFetchingException
*/
public function testGetFolder(): void {
$client = $this->getClient()->connect();
$folder = $client->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
}
/**
* Test to get the default inbox folder by name
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testGetFolderByName(): void {
$client = $this->getClient()->connect();
$folder = $client->getFolderByName('INBOX');
self::assertInstanceOf(Folder::class, $folder);
}
/**
* Test to get the default inbox folder by path
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testGetFolderByPath(): void {
$client = $this->getClient()->connect();
$folder = $client->getFolderByPath('INBOX');
self::assertInstanceOf(Folder::class, $folder);
}
/**
* Test to get all folders
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testGetFolders(): void {
$client = $this->getClient()->connect();
$folders = $client->getFolders(false);
self::assertTrue($folders->count() > 0);
}
public function testGetFoldersWithStatus(): void {
$client = $this->getClient()->connect();
$folders = $client->getFoldersWithStatus(false);
self::assertTrue($folders->count() > 0);
}
public function testOpenFolder(): void {
$client = $this->getClient()->connect();
$status = $client->openFolder("INBOX");
self::assertTrue(isset($status["flags"]) && count($status["flags"]) > 0);
self::assertTrue(($status["uidnext"] ?? 0) > 0);
self::assertTrue(($status["uidvalidity"] ?? 0) > 0);
self::assertTrue(($status["recent"] ?? -1) >= 0);
self::assertTrue(($status["exists"] ?? -1) >= 0);
}
public function testCreateFolder(): void {
$client = $this->getClient()->connect();
$delimiter = $this->getManager()->getConfig()->get("options.delimiter");
$folder_path = implode($delimiter, ['INBOX', $this->getSpecialChars()]);
$folder = $client->getFolder($folder_path);
$this->deleteFolder($folder);
$folder = $client->createFolder($folder_path, false);
self::assertInstanceOf(Folder::class, $folder);
$folder = $this->getFolder($folder_path);
self::assertInstanceOf(Folder::class, $folder);
$this->assertEquals($this->getSpecialChars(), $folder->name);
$this->assertEquals($folder_path, $folder->full_name);
$folder_path = implode($delimiter, ['INBOX', EncodingAliases::convert($this->getSpecialChars(), "utf-8", "utf7-imap")]);
$this->assertEquals($folder_path, $folder->path);
// Clean up
if ($this->deleteFolder($folder) === false) {
$this->fail("Could not delete folder: " . $folder->path);
}
}
public function testCheckFolder(): void {
$client = $this->getClient()->connect();
$status = $client->checkFolder("INBOX");
self::assertTrue(isset($status["flags"]) && count($status["flags"]) > 0);
self::assertTrue(($status["uidnext"] ?? 0) > 0);
self::assertTrue(($status["uidvalidity"] ?? 0) > 0);
self::assertTrue(($status["recent"] ?? -1) >= 0);
self::assertTrue(($status["exists"] ?? -1) >= 0);
}
public function testGetFolderPath(): void {
$client = $this->getClient()->connect();
self::assertIsArray($client->openFolder("INBOX"));
self::assertEquals("INBOX", $client->getFolderPath());
}
public function testId(): void {
$client = $this->getClient()->connect();
$info = $client->Id();
self::assertIsArray($info);
$valid = false;
foreach ($info as $value) {
if (str_starts_with($value, "OK")) {
$valid = true;
break;
}
}
self::assertTrue($valid);
}
public function testGetQuotaRoot(): void {
if (!getenv("LIVE_MAILBOX_QUOTA_SUPPORT")) {
$this->markTestSkipped("Quota support is not enabled");
}
$client = $this->getClient()->connect();
$quota = $client->getQuotaRoot("INBOX");
self::assertIsArray($quota);
self::assertTrue(count($quota) > 1);
self::assertIsArray($quota[0]);
self::assertEquals("INBOX", $quota[0][1]);
self::assertIsArray($quota[1]);
self::assertIsArray($quota[1][2]);
self::assertTrue($quota[1][2][2] > 0);
}
public function testSetTimeout(): void {
$client = $this->getClient()->connect();
self::assertInstanceOf(ProtocolInterface::class, $client->setTimeout(57));
self::assertEquals(57, $client->getTimeout());
}
public function testExpunge(): void {
$client = $this->getClient()->connect();
$client->openFolder("INBOX");
$status = $client->expunge();
self::assertIsArray($status);
self::assertIsArray($status[0]);
self::assertEquals("OK", $status[0][0]);
}
public function testGetDefaultMessageMask(): void {
$client = $this->getClient();
self::assertEquals(MessageMask::class, $client->getDefaultMessageMask());
}
public function testGetDefaultEvents(): void {
$client = $this->getClient();
self::assertIsArray($client->getDefaultEvents("message"));
}
public function testSetDefaultMessageMask(): void {
$client = $this->getClient();
self::assertInstanceOf(Client::class, $client->setDefaultMessageMask(AttachmentMask::class));
self::assertEquals(AttachmentMask::class, $client->getDefaultMessageMask());
$client->setDefaultMessageMask(MessageMask::class);
}
public function testGetDefaultAttachmentMask(): void {
$client = $this->getClient();
self::assertEquals(AttachmentMask::class, $client->getDefaultAttachmentMask());
}
public function testSetDefaultAttachmentMask(): void {
$client = $this->getClient();
self::assertInstanceOf(Client::class, $client->setDefaultAttachmentMask(MessageMask::class));
self::assertEquals(MessageMask::class, $client->getDefaultAttachmentMask());
$client->setDefaultAttachmentMask(AttachmentMask::class);
}
}

View File

@@ -0,0 +1,447 @@
<?php
/*
* File: FolderTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 04.03.23 03:52
* Updated: -
*
* Description:
* -
*/
namespace Tests\live;
use Webklex\PHPIMAP\Client;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\MessageContentFetchingException;
use Webklex\PHPIMAP\Exceptions\MessageFlagException;
use Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException;
use Webklex\PHPIMAP\Exceptions\MessageNotFoundException;
use Webklex\PHPIMAP\Exceptions\ResponseException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
use Webklex\PHPIMAP\Folder;
use Webklex\PHPIMAP\Message;
use Webklex\PHPIMAP\Query\WhereQuery;
use Webklex\PHPIMAP\Support\FolderCollection;
/**
* Class FolderTest
*
* @package Tests
*/
class FolderTest extends LiveMailboxTestCase {
/**
* Try to create a new query instance
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testQuery(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
self::assertInstanceOf(WhereQuery::class, $folder->query());
self::assertInstanceOf(WhereQuery::class, $folder->search());
self::assertInstanceOf(WhereQuery::class, $folder->messages());
}
/**
* Test Folder::hasChildren()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
* @throws EventNotFoundException
*/
public function testHasChildren(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$delimiter = $this->getManager()->getConfig()->get("options.delimiter");
$child_path = implode($delimiter, ['INBOX', 'test']);
if ($folder->getClient()->getFolder($child_path) === null) {
$folder->getClient()->createFolder($child_path, false);
$folder = $this->getFolder('INBOX');
}
self::assertTrue($folder->hasChildren());
}
/**
* Test Folder::setChildren()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testSetChildren(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$delimiter = $this->getManager()->getConfig()->get("options.delimiter");
$child_path = implode($delimiter, ['INBOX', 'test']);
if ($folder->getClient()->getFolder($child_path) === null) {
$folder->getClient()->createFolder($child_path, false);
$folder = $this->getFolder('INBOX');
}
self::assertTrue($folder->hasChildren());
$folder->setChildren(new FolderCollection());
self::assertTrue($folder->getChildren()->isEmpty());
}
/**
* Test Folder::getChildren()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testGetChildren(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$delimiter = $this->getManager()->getConfig()->get("options.delimiter");
$child_path = implode($delimiter, ['INBOX', 'test']);
if ($folder->getClient()->getFolder($child_path) === null) {
$folder->getClient()->createFolder($child_path, false);
}
$folder = $folder->getClient()->getFolders()->where('name', 'INBOX')->first();
self::assertInstanceOf(Folder::class, $folder);
self::assertTrue($folder->hasChildren());
self::assertFalse($folder->getChildren()->isEmpty());
}
/**
* Test Folder::move()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testMove(): void {
$client = $this->getClient();
$delimiter = $this->getManager()->getConfig()->get("options.delimiter");
$folder_path = implode($delimiter, ['INBOX', 'test']);
$folder = $client->getFolder($folder_path);
if ($folder === null) {
$folder = $client->createFolder($folder_path, false);
}
$new_folder_path = implode($delimiter, ['INBOX', 'other']);
$new_folder = $client->getFolder($new_folder_path);
$new_folder?->delete(false);
$status = $folder->move($new_folder_path, false);
self::assertIsArray($status);
self::assertTrue(str_starts_with($status[0], 'OK'));
$new_folder = $client->getFolder($new_folder_path);
self::assertEquals($new_folder_path, $new_folder->path);
self::assertEquals('other', $new_folder->name);
if ($this->deleteFolder($new_folder) === false) {
$this->fail("Could not delete folder: " . $new_folder->path);
}
}
/**
* Test Folder::delete()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testDelete(): void {
$client = $this->getClient();
$delimiter = $this->getManager()->getConfig()->get("options.delimiter");
$folder_path = implode($delimiter, ['INBOX', 'test']);
$folder = $client->getFolder($folder_path);
if ($folder === null) {
$folder = $client->createFolder($folder_path, false);
}
self::assertInstanceOf(Folder::class, $folder);
if ($this->deleteFolder($folder) === false) {
$this->fail("Could not delete folder: " . $folder->path);
}
}
/**
* Test Folder::overview()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
* @throws InvalidMessageDateException
* @throws MessageContentFetchingException
* @throws MessageFlagException
* @throws MessageHeaderFetchingException
* @throws MessageNotFoundException
*/
public function testOverview(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$folder->select();
// Test empty overview
$overview = $folder->overview();
self::assertIsArray($overview);
self::assertCount(0, $overview);
$message = $this->appendMessageTemplate($folder, "plain.eml");
$overview = $folder->overview();
self::assertIsArray($overview);
self::assertCount(1, $overview);
self::assertEquals($message->from->first()->full, end($overview)["from"]->toString());
self::assertTrue($message->delete());
}
/**
* Test Folder::appendMessage()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MaskNotFoundException
* @throws MessageContentFetchingException
* @throws MessageFlagException
* @throws MessageHeaderFetchingException
* @throws MessageNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testAppendMessage(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$message = $this->appendMessageTemplate($folder, "plain.eml");
self::assertInstanceOf(Message::class, $message);
self::assertEquals("Example", $message->subject);
self::assertEquals("to@someone-else.com", $message->to);
self::assertEquals("from@someone.com", $message->from);
// Clean up
$this->assertTrue($message->delete(true));
}
/**
* Test Folder::subscribe()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testSubscribe(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$status = $folder->subscribe();
self::assertIsArray($status);
self::assertTrue(str_starts_with($status[0], 'OK'));
// Clean up
$folder->unsubscribe();
}
/**
* Test Folder::unsubscribe()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testUnsubscribe(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$folder->subscribe();
$status = $folder->subscribe();
self::assertIsArray($status);
self::assertTrue(str_starts_with($status[0], 'OK'));
}
/**
* Test Folder::status()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testStatus(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$status = $folder->status();
self::assertEquals(0, $status['messages']);
self::assertEquals(0, $status['recent']);
self::assertEquals(0, $status['unseen']);
self::assertGreaterThan(0, $status['uidnext']);
self::assertGreaterThan(0, $status['uidvalidity']);
}
/**
* Test Folder::examine()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testExamine(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$status = $folder->examine();
self::assertTrue(isset($status["flags"]) && count($status["flags"]) > 0);
self::assertTrue(($status["uidnext"] ?? 0) > 0);
self::assertTrue(($status["uidvalidity"] ?? 0) > 0);
self::assertTrue(($status["recent"] ?? -1) >= 0);
self::assertTrue(($status["exists"] ?? -1) >= 0);
}
/**
* Test Folder::getClient()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testGetClient(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
self::assertInstanceOf(Client::class, $folder->getClient());
}
/**
* Test Folder::setDelimiter()
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testSetDelimiter(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$folder->setDelimiter("/");
self::assertEquals("/", $folder->delimiter);
$folder->setDelimiter(".");
self::assertEquals(".", $folder->delimiter);
$default_delimiter = $this->getManager()->getConfig()->get("options.delimiter", "/");
$folder->setDelimiter(null);
self::assertEquals($default_delimiter, $folder->delimiter);
}
}

View File

@@ -0,0 +1,475 @@
<?php
/*
* File: LegacyTest.php
* Category: Test
* Author: M.Goldenbaum
* Created: 23.06.23 18:25
* Updated: -
*
* Description:
* -
*/
namespace Tests\live;
use Carbon\Carbon;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Client;
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
use Webklex\PHPIMAP\Exceptions\GetMessagesFailedException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
use Webklex\PHPIMAP\Exceptions\InvalidWhereQueryCriteriaException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\MessageContentFetchingException;
use Webklex\PHPIMAP\Exceptions\MessageFlagException;
use Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException;
use Webklex\PHPIMAP\Exceptions\MessageSearchValidationException;
use Webklex\PHPIMAP\Exceptions\ResponseException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
use Webklex\PHPIMAP\Folder;
use Webklex\PHPIMAP\Message;
use Webklex\PHPIMAP\Query\WhereQuery;
/**
* Class LegacyTest
*
* @package Tests
*/
class LegacyTest extends TestCase {
/**
* Client
*/
protected static Client $client;
/**
* Create a new LegacyTest instance.
* @param string|null $name
* @param array $data
* @param int|string $dataName
*/
public function __construct(?string $name = null, array $data = [], int|string $dataName = '') {
if (!getenv("LIVE_MAILBOX") ?? false) {
$this->markTestSkipped("This test requires a live mailbox. Please set the LIVE_MAILBOX environment variable to run this test.");
}
parent::__construct($name, $data, $dataName);
$manager = new ClientManager([
'options' => [
"debug" => $_ENV["LIVE_MAILBOX_DEBUG"] ?? false,
],
'accounts' => [
'legacy' => [
'host' => getenv("LIVE_MAILBOX_HOST"),
'port' => getenv("LIVE_MAILBOX_PORT"),
'encryption' => getenv("LIVE_MAILBOX_ENCRYPTION"),
'validate_cert' => getenv("LIVE_MAILBOX_VALIDATE_CERT"),
'username' => getenv("LIVE_MAILBOX_USERNAME"),
'password' => getenv("LIVE_MAILBOX_PASSWORD"),
'protocol' => 'legacy-imap',
],
],
]);
self::$client = $manager->account('legacy');
self::$client->connect();
self::assertInstanceOf(Client::class, self::$client->connect());
}
/**
* @throws RuntimeException
* @throws MessageFlagException
* @throws MessageContentFetchingException
* @throws ResponseException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ConnectionFailedException
* @throws InvalidMessageDateException
* @throws AuthFailedException
* @throws MessageHeaderFetchingException
*/
public function testSizes(): void {
$delimiter = self::$client->getConfig()->get("options.delimiter");
$child_path = implode($delimiter, ['INBOX', 'test']);
if (self::$client->getFolder($child_path) === null) {
self::$client->createFolder($child_path, false);
}
$folder = $this->getFolder($child_path);
self::assertInstanceOf(Folder::class, $folder);
$message = $this->appendMessageTemplate($folder, "plain.eml");
self::assertInstanceOf(Message::class, $message);
self::assertEquals(214, $message->size);
self::assertEquals(214, self::$client->getConnection()->sizes($message->uid)->array()[$message->uid]);
}
/**
* Try to create a new query instance
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testQuery(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
self::assertInstanceOf(WhereQuery::class, $folder->query());
self::assertInstanceOf(WhereQuery::class, $folder->search());
self::assertInstanceOf(WhereQuery::class, $folder->messages());
}
/**
* Get a folder
* @param string $folder_path
*
* @return Folder
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
* @throws FolderFetchingException
*/
final protected function getFolder(string $folder_path = "INDEX"): Folder {
$folder = self::$client->getFolderByPath($folder_path);
self::assertInstanceOf(Folder::class, $folder);
return $folder;
}
/**
* Append a message to a folder
* @param Folder $folder
* @param string $message
*
* @return Message
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MessageContentFetchingException
* @throws MessageFlagException
* @throws MessageHeaderFetchingException
* @throws ResponseException
* @throws RuntimeException
*/
final protected function appendMessage(Folder $folder, string $message): Message {
$status = $folder->select();
if (!isset($status['uidnext'])) {
$this->fail("No UIDNEXT returned");
}
$response = $folder->appendMessage($message);
$valid_response = false;
foreach ($response as $line) {
if (str_starts_with($line, 'OK')) {
$valid_response = true;
break;
}
}
if (!$valid_response) {
$this->fail("Failed to append message: ".implode("\n", $response));
}
$message = $folder->messages()->getMessageByUid($status['uidnext']);
self::assertInstanceOf(Message::class, $message);
return $message;
}
/**
* Append a message template to a folder
* @param Folder $folder
* @param string $template
*
* @return Message
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MessageContentFetchingException
* @throws MessageFlagException
* @throws MessageHeaderFetchingException
* @throws ResponseException
* @throws RuntimeException
*/
final protected function appendMessageTemplate(Folder $folder, string $template): Message {
$content = file_get_contents(implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", $template]));
return $this->appendMessage($folder, $content);
}
/**
* Delete a folder if it is given
* @param Folder|null $folder
*
* @return bool
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws ResponseException
* @throws RuntimeException
*/
final protected function deleteFolder(Folder $folder = null): bool {
$response = $folder?->delete(false);
if (is_array($response)) {
$valid_response = false;
foreach ($response as $line) {
if (str_starts_with($line, 'OK')) {
$valid_response = true;
break;
}
}
if (!$valid_response) {
$this->fail("Failed to delete mailbox: ".implode("\n", $response));
}
return $valid_response;
}
return false;
}
/**
* Try to create a new query instance with a where clause
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MaskNotFoundException
* @throws MessageContentFetchingException
* @throws MessageFlagException
* @throws MessageHeaderFetchingException
* @throws ResponseException
* @throws RuntimeException
* @throws GetMessagesFailedException
* @throws InvalidWhereQueryCriteriaException
* @throws MessageSearchValidationException
*/
public function testQueryWhere(): void {
$delimiter = self::$client->getConfig()->get("options.delimiter");
$folder_path = implode($delimiter, ['INBOX', 'search']);
$folder = self::$client->getFolder($folder_path);
if ($folder !== null) {
self::assertTrue($this->deleteFolder($folder));
}
$folder = self::$client->createFolder($folder_path, false);
$messages = [
$this->appendMessageTemplate($folder, '1366671050@github.com.eml'),
$this->appendMessageTemplate($folder, 'attachment_encoded_filename.eml'),
$this->appendMessageTemplate($folder, 'attachment_long_filename.eml'),
$this->appendMessageTemplate($folder, 'attachment_no_disposition.eml'),
$this->appendMessageTemplate($folder, 'bcc.eml'),
$this->appendMessageTemplate($folder, 'boolean_decoded_content.eml'),
$this->appendMessageTemplate($folder, 'email_address.eml'),
$this->appendMessageTemplate($folder, 'embedded_email.eml'),
$this->appendMessageTemplate($folder, 'embedded_email_without_content_disposition.eml'),
$this->appendMessageTemplate($folder, 'embedded_email_without_content_disposition-embedded.eml'),
$this->appendMessageTemplate($folder, 'example_attachment.eml'),
$this->appendMessageTemplate($folder, 'example_bounce.eml'),
$this->appendMessageTemplate($folder, 'four_nested_emails.eml'),
$this->appendMessageTemplate($folder, 'gbk_charset.eml'),
$this->appendMessageTemplate($folder, 'html_only.eml'),
$this->appendMessageTemplate($folder, 'imap_mime_header_decode_returns_false.eml'),
$this->appendMessageTemplate($folder, 'inline_attachment.eml'),
$this->appendMessageTemplate($folder, 'issue-275.eml'),
$this->appendMessageTemplate($folder, 'issue-275-2.eml'),
$this->appendMessageTemplate($folder, 'issue-348.eml'),
$this->appendMessageTemplate($folder, 'ks_c_5601-1987_headers.eml'),
$this->appendMessageTemplate($folder, 'mail_that_is_attachment.eml'),
$this->appendMessageTemplate($folder, 'missing_date.eml'),
$this->appendMessageTemplate($folder, 'missing_from.eml'),
$this->appendMessageTemplate($folder, 'mixed_filename.eml'),
$this->appendMessageTemplate($folder, 'multipart_without_body.eml'),
$this->appendMessageTemplate($folder, 'multiple_html_parts_and_attachments.eml'),
$this->appendMessageTemplate($folder, 'multiple_nested_attachments.eml'),
$this->appendMessageTemplate($folder, 'nestes_embedded_with_attachment.eml'),
$this->appendMessageTemplate($folder, 'null_content_charset.eml'),
$this->appendMessageTemplate($folder, 'pec.eml'),
$this->appendMessageTemplate($folder, 'plain.eml'),
$this->appendMessageTemplate($folder, 'plain_only.eml'),
$this->appendMessageTemplate($folder, 'plain_text_attachment.eml'),
$this->appendMessageTemplate($folder, 'references.eml'),
$this->appendMessageTemplate($folder, 'simple_multipart.eml'),
$this->appendMessageTemplate($folder, 'structured_with_attachment.eml'),
$this->appendMessageTemplate($folder, 'thread_my_topic.eml'),
$this->appendMessageTemplate($folder, 'thread_re_my_topic.eml'),
$this->appendMessageTemplate($folder, 'thread_unrelated.eml'),
$this->appendMessageTemplate($folder, 'undefined_charset_header.eml'),
$this->appendMessageTemplate($folder, 'undisclosed_recipients_minus.eml'),
$this->appendMessageTemplate($folder, 'undisclosed_recipients_space.eml'),
$this->appendMessageTemplate($folder, 'unknown_encoding.eml'),
$this->appendMessageTemplate($folder, 'without_charset_plain_only.eml'),
$this->appendMessageTemplate($folder, 'without_charset_simple_multipart.eml'),
];
$folder->getClient()->expunge();
$query = $folder->query()->all();
self::assertEquals(count($messages), $query->count());
$query = $folder->query()->whereSubject("test");
self::assertEquals(11, $query->count());
$query = $folder->query()->whereOn(Carbon::now());
self::assertEquals(count($messages), $query->count());
self::assertTrue($this->deleteFolder($folder));
}
/**
* Test query where criteria
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidWhereQueryCriteriaException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testQueryWhereCriteria(): void {
self::$client->reconnect();
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$this->assertWhereSearchCriteria($folder, 'SUBJECT', 'Test');
$this->assertWhereSearchCriteria($folder, 'BODY', 'Test');
$this->assertWhereSearchCriteria($folder, 'TEXT', 'Test');
$this->assertWhereSearchCriteria($folder, 'KEYWORD', 'Test');
$this->assertWhereSearchCriteria($folder, 'UNKEYWORD', 'Test');
$this->assertWhereSearchCriteria($folder, 'FLAGGED', 'Seen');
$this->assertWhereSearchCriteria($folder, 'UNFLAGGED', 'Seen');
$this->assertHeaderSearchCriteria($folder, 'Message-ID', 'Seen');
$this->assertHeaderSearchCriteria($folder, 'In-Reply-To', 'Seen');
$this->assertWhereSearchCriteria($folder, 'BCC', 'test@example.com');
$this->assertWhereSearchCriteria($folder, 'CC', 'test@example.com');
$this->assertWhereSearchCriteria($folder, 'FROM', 'test@example.com');
$this->assertWhereSearchCriteria($folder, 'TO', 'test@example.com');
$this->assertWhereSearchCriteria($folder, 'UID', '1');
$this->assertWhereSearchCriteria($folder, 'UID', '1,2');
$this->assertWhereSearchCriteria($folder, 'ALL');
$this->assertWhereSearchCriteria($folder, 'NEW');
$this->assertWhereSearchCriteria($folder, 'OLD');
$this->assertWhereSearchCriteria($folder, 'SEEN');
$this->assertWhereSearchCriteria($folder, 'UNSEEN');
$this->assertWhereSearchCriteria($folder, 'RECENT');
$this->assertWhereSearchCriteria($folder, 'ANSWERED');
$this->assertWhereSearchCriteria($folder, 'UNANSWERED');
$this->assertWhereSearchCriteria($folder, 'DELETED');
$this->assertWhereSearchCriteria($folder, 'UNDELETED');
$this->assertHeaderSearchCriteria($folder, 'Content-Language','en_US');
$this->assertWhereSearchCriteria($folder, 'CUSTOM X-Spam-Flag NO');
$this->assertWhereSearchCriteria($folder, 'CUSTOM X-Spam-Flag YES');
$this->assertWhereSearchCriteria($folder, 'NOT');
$this->assertWhereSearchCriteria($folder, 'OR');
$this->assertWhereSearchCriteria($folder, 'AND');
$this->assertWhereSearchCriteria($folder, 'BEFORE', '01-Jan-2020', true);
$this->assertWhereSearchCriteria($folder, 'BEFORE', Carbon::now()->subDays(1), true);
$this->assertWhereSearchCriteria($folder, 'ON', '01-Jan-2020', true);
$this->assertWhereSearchCriteria($folder, 'ON', Carbon::now()->subDays(1), true);
$this->assertWhereSearchCriteria($folder, 'SINCE', '01-Jan-2020', true);
$this->assertWhereSearchCriteria($folder, 'SINCE', Carbon::now()->subDays(1), true);
}
/**
* Assert where search criteria
* @param Folder $folder
* @param string $criteria
* @param string|Carbon|null $value
* @param bool $date
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidWhereQueryCriteriaException
* @throws ResponseException
* @throws RuntimeException
*/
protected function assertWhereSearchCriteria(Folder $folder, string $criteria, Carbon|string $value = null, bool $date = false): void {
$query = $folder->query()->where($criteria, $value);
self::assertInstanceOf(WhereQuery::class, $query);
$item = $query->getQuery()->first();
$criteria = str_replace("CUSTOM ", "", $criteria);
$expected = $value === null ? [$criteria] : [$criteria, $value];
if ($date === true && $value instanceof Carbon) {
$date_format = $folder->getClient()->getConfig()->get('date_format', 'd M y');
$expected[1] = $value->format($date_format);
}
self::assertIsArray($item);
self::assertIsString($item[0]);
if($value !== null) {
self::assertCount(2, $item);
self::assertIsString($item[1]);
}else{
self::assertCount(1, $item);
}
self::assertSame($expected, $item);
}
/**
* Assert header search criteria
* @param Folder $folder
* @param string $criteria
* @param mixed|null $value
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidWhereQueryCriteriaException
* @throws ResponseException
* @throws RuntimeException
*/
protected function assertHeaderSearchCriteria(Folder $folder, string $criteria, mixed $value = null): void {
$query = $folder->query()->whereHeader($criteria, $value);
self::assertInstanceOf(WhereQuery::class, $query);
$item = $query->getQuery()->first();
self::assertIsArray($item);
self::assertIsString($item[0]);
self::assertCount(1, $item);
self::assertSame(['HEADER '.$criteria.' '.$value], $item);
}
}

View File

@@ -0,0 +1,220 @@
<?php
/*
* File: LiveMailboxTestCase.php
* Category: -
* Author: M.Goldenbaum
* Created: 04.03.23 03:43
* Updated: -
*
* Description:
* -
*/
namespace Tests\live;
use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Client;
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\MessageContentFetchingException;
use Webklex\PHPIMAP\Exceptions\MessageFlagException;
use Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException;
use Webklex\PHPIMAP\Exceptions\ResponseException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
use Webklex\PHPIMAP\Folder;
use Webklex\PHPIMAP\Message;
/**
* Class LiveMailboxTestCase
*
* @package Tests
*/
abstract class LiveMailboxTestCase extends TestCase {
/**
* Special chars
*/
const SPECIAL_CHARS = 'A_\\|!"£$%&()=?àèìòùÀÈÌÒÙ<>-@#[]_ß_б_π_€_✔_你_يد_Z_';
/**
* Client manager
* @var ClientManager $manager
*/
protected static ClientManager $manager;
/**
* Get the client manager
*
* @return ClientManager
*/
final protected function getManager(): ClientManager {
if (!isset(self::$manager)) {
self::$manager = new ClientManager([
'options' => [
"debug" => $_ENV["LIVE_MAILBOX_DEBUG"] ?? false,
],
'accounts' => [
'default' => [
'host' => getenv("LIVE_MAILBOX_HOST"),
'port' => getenv("LIVE_MAILBOX_PORT"),
'encryption' => getenv("LIVE_MAILBOX_ENCRYPTION"),
'validate_cert' => getenv("LIVE_MAILBOX_VALIDATE_CERT"),
'username' => getenv("LIVE_MAILBOX_USERNAME"),
'password' => getenv("LIVE_MAILBOX_PASSWORD"),
'protocol' => 'imap', //might also use imap, [pop3 or nntp (untested)]
],
],
]);
}
return self::$manager;
}
/**
* Get the client
*
* @return Client
* @throws MaskNotFoundException
*/
final protected function getClient(): Client {
if (!getenv("LIVE_MAILBOX") ?? false) {
$this->markTestSkipped("This test requires a live mailbox. Please set the LIVE_MAILBOX environment variable to run this test.");
}
return $this->getManager()->account('default');
}
/**
* Get special chars
*
* @return string
*/
final protected function getSpecialChars(): string {
return self::SPECIAL_CHARS;
}
/**
* Get a folder
* @param string $folder_path
*
* @return Folder
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
* @throws FolderFetchingException
*/
final protected function getFolder(string $folder_path = "INDEX"): Folder {
$client = $this->getClient();
self::assertInstanceOf(Client::class, $client->connect());
$folder = $client->getFolderByPath($folder_path);
self::assertInstanceOf(Folder::class, $folder);
return $folder;
}
/**
* Append a message to a folder
* @param Folder $folder
* @param string $message
*
* @return Message
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MessageContentFetchingException
* @throws MessageFlagException
* @throws MessageHeaderFetchingException
* @throws ResponseException
* @throws RuntimeException
*/
final protected function appendMessage(Folder $folder, string $message): Message {
$status = $folder->select();
if (!isset($status['uidnext'])) {
$this->fail("No UIDNEXT returned");
}
$response = $folder->appendMessage($message);
$valid_response = false;
foreach ($response as $line) {
if (str_starts_with($line, 'OK')) {
$valid_response = true;
break;
}
}
if (!$valid_response) {
$this->fail("Failed to append message: ".implode("\n", $response));
}
$message = $folder->messages()->getMessageByUid($status['uidnext']);
self::assertInstanceOf(Message::class, $message);
return $message;
}
/**
* Append a message template to a folder
* @param Folder $folder
* @param string $template
*
* @return Message
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MessageContentFetchingException
* @throws MessageFlagException
* @throws MessageHeaderFetchingException
* @throws ResponseException
* @throws RuntimeException
*/
final protected function appendMessageTemplate(Folder $folder, string $template): Message {
$content = file_get_contents(implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", $template]));
return $this->appendMessage($folder, $content);
}
/**
* Delete a folder if it is given
* @param Folder|null $folder
*
* @return bool
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws ResponseException
* @throws RuntimeException
*/
final protected function deleteFolder(Folder $folder = null): bool {
$response = $folder?->delete(false);
if (is_array($response)) {
$valid_response = false;
foreach ($response as $line) {
if (str_starts_with($line, 'OK')) {
$valid_response = true;
break;
}
}
if (!$valid_response) {
$this->fail("Failed to delete mailbox: ".implode("\n", $response));
}
return $valid_response;
}
return false;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,283 @@
<?php
/*
* File: QueryTest.php
* Category: -
* Author: M.Goldenbaum
* Created: 04.03.23 03:52
* Updated: -
*
* Description:
* -
*/
namespace Tests\live;
use Carbon\Carbon;
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\Exceptions\AuthFailedException;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\EventNotFoundException;
use Webklex\PHPIMAP\Exceptions\FolderFetchingException;
use Webklex\PHPIMAP\Exceptions\GetMessagesFailedException;
use Webklex\PHPIMAP\Exceptions\ImapBadRequestException;
use Webklex\PHPIMAP\Exceptions\ImapServerErrorException;
use Webklex\PHPIMAP\Exceptions\InvalidMessageDateException;
use Webklex\PHPIMAP\Exceptions\InvalidWhereQueryCriteriaException;
use Webklex\PHPIMAP\Exceptions\MaskNotFoundException;
use Webklex\PHPIMAP\Exceptions\MessageContentFetchingException;
use Webklex\PHPIMAP\Exceptions\MessageFlagException;
use Webklex\PHPIMAP\Exceptions\MessageHeaderFetchingException;
use Webklex\PHPIMAP\Exceptions\MessageSearchValidationException;
use Webklex\PHPIMAP\Exceptions\ResponseException;
use Webklex\PHPIMAP\Exceptions\RuntimeException;
use Webklex\PHPIMAP\Folder;
use Webklex\PHPIMAP\Query\WhereQuery;
/**
* Class QueryTest
*
* @package Tests
*/
class QueryTest extends LiveMailboxTestCase {
/**
* Try to create a new query instance
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testQuery(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
self::assertInstanceOf(WhereQuery::class, $folder->query());
self::assertInstanceOf(WhereQuery::class, $folder->search());
self::assertInstanceOf(WhereQuery::class, $folder->messages());
}
/**
* Try to create a new query instance with a where clause
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws EventNotFoundException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidMessageDateException
* @throws MaskNotFoundException
* @throws MessageContentFetchingException
* @throws MessageFlagException
* @throws MessageHeaderFetchingException
* @throws ResponseException
* @throws RuntimeException
* @throws GetMessagesFailedException
* @throws InvalidWhereQueryCriteriaException
* @throws MessageSearchValidationException
*/
public function testQueryWhere(): void {
$client = $this->getClient();
$delimiter = $this->getManager()->getConfig()->get("options.delimiter");
$folder_path = implode($delimiter, ['INBOX', 'search']);
$folder = $client->getFolder($folder_path);
if ($folder !== null) {
self::assertTrue($this->deleteFolder($folder));
}
$folder = $client->createFolder($folder_path, false);
$messages = [
$this->appendMessageTemplate($folder, '1366671050@github.com.eml'),
$this->appendMessageTemplate($folder, 'attachment_encoded_filename.eml'),
$this->appendMessageTemplate($folder, 'attachment_long_filename.eml'),
$this->appendMessageTemplate($folder, 'attachment_no_disposition.eml'),
$this->appendMessageTemplate($folder, 'bcc.eml'),
$this->appendMessageTemplate($folder, 'boolean_decoded_content.eml'),
$this->appendMessageTemplate($folder, 'email_address.eml'),
$this->appendMessageTemplate($folder, 'embedded_email.eml'),
$this->appendMessageTemplate($folder, 'embedded_email_without_content_disposition.eml'),
$this->appendMessageTemplate($folder, 'embedded_email_without_content_disposition-embedded.eml'),
$this->appendMessageTemplate($folder, 'example_attachment.eml'),
$this->appendMessageTemplate($folder, 'example_bounce.eml'),
$this->appendMessageTemplate($folder, 'four_nested_emails.eml'),
$this->appendMessageTemplate($folder, 'gbk_charset.eml'),
$this->appendMessageTemplate($folder, 'html_only.eml'),
$this->appendMessageTemplate($folder, 'imap_mime_header_decode_returns_false.eml'),
$this->appendMessageTemplate($folder, 'inline_attachment.eml'),
$this->appendMessageTemplate($folder, 'issue-275.eml'),
$this->appendMessageTemplate($folder, 'issue-275-2.eml'),
$this->appendMessageTemplate($folder, 'issue-348.eml'),
$this->appendMessageTemplate($folder, 'ks_c_5601-1987_headers.eml'),
$this->appendMessageTemplate($folder, 'mail_that_is_attachment.eml'),
$this->appendMessageTemplate($folder, 'missing_date.eml'),
$this->appendMessageTemplate($folder, 'missing_from.eml'),
$this->appendMessageTemplate($folder, 'mixed_filename.eml'),
$this->appendMessageTemplate($folder, 'multipart_without_body.eml'),
$this->appendMessageTemplate($folder, 'multiple_html_parts_and_attachments.eml'),
$this->appendMessageTemplate($folder, 'multiple_nested_attachments.eml'),
$this->appendMessageTemplate($folder, 'nestes_embedded_with_attachment.eml'),
$this->appendMessageTemplate($folder, 'null_content_charset.eml'),
$this->appendMessageTemplate($folder, 'pec.eml'),
$this->appendMessageTemplate($folder, 'plain.eml'),
$this->appendMessageTemplate($folder, 'plain_only.eml'),
$this->appendMessageTemplate($folder, 'plain_text_attachment.eml'),
$this->appendMessageTemplate($folder, 'references.eml'),
$this->appendMessageTemplate($folder, 'simple_multipart.eml'),
$this->appendMessageTemplate($folder, 'structured_with_attachment.eml'),
$this->appendMessageTemplate($folder, 'thread_my_topic.eml'),
$this->appendMessageTemplate($folder, 'thread_re_my_topic.eml'),
$this->appendMessageTemplate($folder, 'thread_unrelated.eml'),
$this->appendMessageTemplate($folder, 'undefined_charset_header.eml'),
$this->appendMessageTemplate($folder, 'undisclosed_recipients_minus.eml'),
$this->appendMessageTemplate($folder, 'undisclosed_recipients_space.eml'),
$this->appendMessageTemplate($folder, 'unknown_encoding.eml'),
$this->appendMessageTemplate($folder, 'without_charset_plain_only.eml'),
$this->appendMessageTemplate($folder, 'without_charset_simple_multipart.eml'),
];
$folder->getClient()->expunge();
$query = $folder->query()->all();
self::assertEquals(count($messages), $query->count());
$query = $folder->query()->whereSubject("test");
self::assertEquals(11, $query->count());
$query = $folder->query()->whereOn(Carbon::now());
self::assertEquals(count($messages), $query->count());
self::assertTrue($this->deleteFolder($folder));
}
/**
* Test query where criteria
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws FolderFetchingException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidWhereQueryCriteriaException
* @throws MaskNotFoundException
* @throws ResponseException
* @throws RuntimeException
*/
public function testQueryWhereCriteria(): void {
$folder = $this->getFolder('INBOX');
self::assertInstanceOf(Folder::class, $folder);
$this->assertWhereSearchCriteria($folder, 'SUBJECT', 'Test');
$this->assertWhereSearchCriteria($folder, 'BODY', 'Test');
$this->assertWhereSearchCriteria($folder, 'TEXT', 'Test');
$this->assertWhereSearchCriteria($folder, 'KEYWORD', 'Test');
$this->assertWhereSearchCriteria($folder, 'UNKEYWORD', 'Test');
$this->assertWhereSearchCriteria($folder, 'FLAGGED', 'Seen');
$this->assertWhereSearchCriteria($folder, 'UNFLAGGED', 'Seen');
$this->assertHeaderSearchCriteria($folder, 'Message-ID', 'Seen');
$this->assertHeaderSearchCriteria($folder, 'In-Reply-To', 'Seen');
$this->assertWhereSearchCriteria($folder, 'BCC', 'test@example.com');
$this->assertWhereSearchCriteria($folder, 'CC', 'test@example.com');
$this->assertWhereSearchCriteria($folder, 'FROM', 'test@example.com');
$this->assertWhereSearchCriteria($folder, 'TO', 'test@example.com');
$this->assertWhereSearchCriteria($folder, 'UID', '1');
$this->assertWhereSearchCriteria($folder, 'UID', '1,2');
$this->assertWhereSearchCriteria($folder, 'ALL');
$this->assertWhereSearchCriteria($folder, 'NEW');
$this->assertWhereSearchCriteria($folder, 'OLD');
$this->assertWhereSearchCriteria($folder, 'SEEN');
$this->assertWhereSearchCriteria($folder, 'UNSEEN');
$this->assertWhereSearchCriteria($folder, 'RECENT');
$this->assertWhereSearchCriteria($folder, 'ANSWERED');
$this->assertWhereSearchCriteria($folder, 'UNANSWERED');
$this->assertWhereSearchCriteria($folder, 'DELETED');
$this->assertWhereSearchCriteria($folder, 'UNDELETED');
$this->assertHeaderSearchCriteria($folder, 'Content-Language','en_US');
$this->assertWhereSearchCriteria($folder, 'CUSTOM X-Spam-Flag NO');
$this->assertWhereSearchCriteria($folder, 'CUSTOM X-Spam-Flag YES');
$this->assertWhereSearchCriteria($folder, 'NOT');
$this->assertWhereSearchCriteria($folder, 'OR');
$this->assertWhereSearchCriteria($folder, 'AND');
$this->assertWhereSearchCriteria($folder, 'BEFORE', '01-Jan-2020', true);
$this->assertWhereSearchCriteria($folder, 'BEFORE', Carbon::now()->subDays(1), true);
$this->assertWhereSearchCriteria($folder, 'ON', '01-Jan-2020', true);
$this->assertWhereSearchCriteria($folder, 'ON', Carbon::now()->subDays(1), true);
$this->assertWhereSearchCriteria($folder, 'SINCE', '01-Jan-2020', true);
$this->assertWhereSearchCriteria($folder, 'SINCE', Carbon::now()->subDays(1), true);
}
/**
* Assert where search criteria
* @param Folder $folder
* @param string $criteria
* @param string|Carbon|null $value
* @param bool $date
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidWhereQueryCriteriaException
* @throws ResponseException
* @throws RuntimeException
*/
protected function assertWhereSearchCriteria(Folder $folder, string $criteria, Carbon|string $value = null, bool $date = false): void {
$query = $folder->query()->where($criteria, $value);
self::assertInstanceOf(WhereQuery::class, $query);
$item = $query->getQuery()->first();
$criteria = str_replace("CUSTOM ", "", $criteria);
$expected = $value === null ? [$criteria] : [$criteria, $value];
if ($date === true && $value instanceof Carbon) {
$date_format = $folder->getClient()->getConfig()->get('date_format', 'd M y');
$expected[1] = $value->format($date_format);
}
self::assertIsArray($item);
self::assertIsString($item[0]);
if($value !== null) {
self::assertCount(2, $item);
self::assertIsString($item[1]);
}else{
self::assertCount(1, $item);
}
self::assertSame($expected, $item);
}
/**
* Assert header search criteria
* @param Folder $folder
* @param string $criteria
* @param mixed|null $value
*
* @return void
* @throws AuthFailedException
* @throws ConnectionFailedException
* @throws ImapBadRequestException
* @throws ImapServerErrorException
* @throws InvalidWhereQueryCriteriaException
* @throws ResponseException
* @throws RuntimeException
*/
protected function assertHeaderSearchCriteria(Folder $folder, string $criteria, mixed $value = null): void {
$query = $folder->query()->whereHeader($criteria, $value);
self::assertInstanceOf(WhereQuery::class, $query);
$item = $query->getQuery()->first();
self::assertIsArray($item);
self::assertIsString($item[0]);
self::assertCount(1, $item);
self::assertSame(['HEADER '.$criteria.' '.$value], $item);
}
}

View File

@@ -0,0 +1,108 @@
Return-Path: <noreply@github.com>
Delivered-To: someone@domain.tld
Received: from mx.domain.tld
by localhost with LMTP
id SABVMNfGqWP+PAAA0J78UA
(envelope-from <noreply@github.com>)
for <someone@domain.tld>; Mon, 26 Dec 2022 17:07:51 +0100
Received: from localhost (localhost [127.0.0.1])
by mx.domain.tld (Postfix) with ESMTP id C3828140227
for <someone@domain.tld>; Mon, 26 Dec 2022 17:07:51 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at mx.domain.tld
X-Spam-Flag: NO
X-Spam-Score: -4.299
X-Spam-Level:
X-Spam-Status: No, score=-4.299 required=6.31 tests=[BAYES_00=-1.9,
DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_IMAGE_ONLY_16=1.092,
HTML_MESSAGE=0.001, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,
RCVD_IN_MSPIKE_H2=-0.001, T_KAM_HTML_FONT_INVALID=0.01]
autolearn=ham autolearn_force=no
Received: from mx.domain.tld ([127.0.0.1])
by localhost (mx.domain.tld [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id JcIS9RuNBTNx for <someone@domain.tld>;
Mon, 26 Dec 2022 17:07:21 +0100 (CET)
Received: from smtp.github.com (out-26.smtp.github.com [192.30.252.209])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mx.domain.tld (Postfix) with ESMTPS id 6410B13FEB2
for <someone@domain.tld>; Mon, 26 Dec 2022 17:07:21 +0100 (CET)
Received: from github-lowworker-891b8d2.va3-iad.github.net (github-lowworker-891b8d2.va3-iad.github.net [10.48.109.104])
by smtp.github.com (Postfix) with ESMTP id 176985E0200
for <someone@domain.tld>; Mon, 26 Dec 2022 08:07:14 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com;
s=pf2014; t=1672070834;
bh=v91TPiLpM/cpUb4lgt2NMIUfM4HOIxCEWMR1+JTco+Q=;
h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:List-ID:
List-Archive:List-Post:List-Unsubscribe:From;
b=jW4Tac9IjWAPbEImyiYf1bzGLzY3ceohVbBg1V8BlpMTQ+o+yY3YB0eOe20hAsqZR
jrDjArx7rKQcslqBFL/b2B1C51rHuCBrz2cccLEERu9l/u0mTGCxTNtCRXHbCKbnR1
VLWBeFLjATHth83kK6Kt7lkVuty+G3V1B6ZKPhCI=
Date: Mon, 26 Dec 2022 08:07:14 -0800
From: Username <notifications@github.com>
Reply-To: Webklex/php-imap <reply+aibuo5jooM2quaizuoyae0jeuk9queth@reply.github.com>
To: Webklex/php-imap <php-imap@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Message-ID: <Webklex/php-imap/issues/349/1365266070@github.com>
In-Reply-To: <Webklex/php-imap/issues/349@github.com>
References: <Webklex/php-imap/issues/349@github.com>
Subject: Re: [Webklex/php-imap] Read all folders? (Issue #349)
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_63a9c6b293fe_65b5c71014155a";
charset=UTF-8
Content-Transfer-Encoding: 7bit
Precedence: list
X-GitHub-Sender: consigliere23
X-GitHub-Recipient: Webklex
X-GitHub-Reason: subscribed
List-ID: Webklex/php-imap <php-imap.Webklex.github.com>
List-Archive: https://github.com/Webklex/php-imap
List-Post: <mailto:reply+aibuo5jooM2quaizuoyae0jeuk9queth@reply.github.com>
List-Unsubscribe: <mailto:unsub+aibuo5jooM2quaizuoyae0jeuk9queth@reply.github.com>,
<https://github.com/notifications/unsubscribe/ooxee3quaequoob4eux3uSe5seehee9o>
X-Auto-Response-Suppress: All
X-GitHub-Recipient-Address: someone@domain.tld
----==_mimepart_63a9c6b293fe_65b5c71014155a
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Any updates?
--
Reply to this email directly or view it on GitHub:
https://github.com/Webklex/php-imap/issues/349#issuecomment-1365266070
You are receiving this because you are subscribed to this thread.
Message ID: <Webklex/php-imap/issues/349/1365266070@github.com>
----==_mimepart_63a9c6b293fe_65b5c71014155a
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
<p></p>
<p dir="auto">Any updates?</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />Reply to this email directly, <a href="https://github.com/Webklex/php-imap/issues/349#issuecomment-1365266070">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAWAEMH2ZLKHMNNNIBWTUT3WPG7DFANCNFSM6AAAAAATBM42CI">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAWAEMHVWSHRQDWETTTRYPTWPG7DFA5CNFSM6AAAAAATBM42CKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSRMBHJM.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span>&lt;Webklex/php-imap/issues/349/1365266070</span><span>@</span><span>github</span><span>.</span><span>com&gt;</span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/Webklex/php-imap/issues/349#issuecomment-1365266070",
"url": "https://github.com/Webklex/php-imap/issues/349#issuecomment-1365266070",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>
----==_mimepart_63a9c6b293fe_65b5c71014155a--

View File

@@ -0,0 +1,10 @@
Content-Type: multipart/mixed;
boundary="BOUNDARY"
--BOUNDARY
Content-Type: application/vnd.ms-excel; name="=?UTF-8?Q?Prost=C5=99eno=5F2014=5Fposledn=C3=AD_voln=C3=A9_term=C3=ADny.xls?="; charset="UTF-8"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="=?UTF-8?Q?Prost=C5=99eno=5F2014=5Fposledn=C3=AD_voln=C3=A9_term=C3=ADny.xls?="
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAACAAAAwgAAAAAA
AAAAEAAA/v///wAAAAD+////AAAAAMAAAADBAAAA////////////////////////////////

View File

@@ -0,0 +1,55 @@
Content-Type: multipart/mixed;
boundary="BOUNDARY"
--BOUNDARY
Content-Type: text/plain;
name*0*=utf-8''Buchungsbest%C3%A4tigung-%20Rechnung-Gesch%C3%A4ftsbedingung;
name*1*=en-Nr.B123-45%20-%20XXXX%20xxxxxxxxxxxxxxxxx%20XxxX%2C%20L%C3%BCd;
name*2*=xxxxxxxx%20-%20VM%20Klaus%20XXXXXX%20-%20xxxxxxxx.pdf
Content-Disposition: attachment;
filename*0*=utf-8''Buchungsbest%C3%A4tigung-%20Rechnung-Gesch%C3%A4ftsbedin;
filename*1*=gungen-Nr.B123-45%20-%20XXXXX%20xxxxxxxxxxxxxxxxx%20XxxX%2C;
filename*2*=%20L%C3%BCxxxxxxxxxx%20-%20VM%20Klaus%20XXXXXX%20-%20xxxxxxxx.p;
filename*3*=df
Content-Transfer-Encoding: base64
SGkh
--BOUNDARY
Content-Type: text/plain; charset=UTF-8;
name="=?UTF-8?B?MDFfQeKCrMOgw6TEhdCx2YrYr0BaLTAxMjM0NTY3ODktcXdlcnR5dWlv?=
=?UTF-8?Q?pasdfghjklzxcvbnmopqrstuvz-0123456789-qwertyuiopasdfghjklzx?=
=?UTF-8?Q?cvbnmopqrstuvz-0123456789-qwertyuiopasdfghjklzxcvbnmopqrstu?=
=?UTF-8?Q?vz.txt?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename*0*=iso-8859-15''%30%31%5F%41%A4%E0%E4%3F%3F%3F%3F%40%5A%2D%30%31;
filename*1*=%32%33%34%35%36%37%38%39%2D%71%77%65%72%74%79%75%69%6F%70%61;
filename*2*=%73%64%66%67%68%6A%6B%6C%7A%78%63%76%62%6E%6D%6F%70%71%72%73;
filename*3*=%74%75%76%7A%2D%30%31%32%33%34%35%36%37%38%39%2D%71%77%65%72;
filename*4*=%74%79%75%69%6F%70%61%73%64%66%67%68%6A%6B%6C%7A%78%63%76%62;
filename*5*=%6E%6D%6F%70%71%72%73%74%75%76%7A%2D%30%31%32%33%34%35%36%37;
filename*6*=%38%39%2D%71%77%65%72%74%79%75%69%6F%70%61%73%64%66%67%68%6A;
filename*7*=%6B%6C%7A%78%63%76%62%6E%6D%6F%70%71%72%73%74%75%76%7A%2E%74;
filename*8*=%78%74
SGkh
--BOUNDARY
Content-Type: text/plain; charset=UTF-8;
name="=?UTF-8?B?MDJfQeKCrMOgw6TEhdCx2YrYr0BaLTAxMjM0NTY3ODktcXdlcnR5dWlv?=
=?UTF-8?Q?pasdfghjklzxcvbnmopqrstuvz-0123456789-qwertyuiopasdfghjklzx?=
=?UTF-8?Q?cvbnmopqrstuvz-0123456789-qwertyuiopasdfghjklzxcvbnmopqrstu?=
=?UTF-8?Q?vz.txt?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename*0*=UTF-8''%30%32%5F%41%E2%82%AC%C3%A0%C3%A4%C4%85%D0%B1%D9%8A%D8;
filename*1*=%AF%40%5A%2D%30%31%32%33%34%35%36%37%38%39%2D%71%77%65%72%74;
filename*2*=%79%75%69%6F%70%61%73%64%66%67%68%6A%6B%6C%7A%78%63%76%62%6E;
filename*3*=%6D%6F%70%71%72%73%74%75%76%7A%2D%30%31%32%33%34%35%36%37%38;
filename*4*=%39%2D%71%77%65%72%74%79%75%69%6F%70%61%73%64%66%67%68%6A%6B;
filename*5*=%6C%7A%78%63%76%62%6E%6D%6F%70%71%72%73%74%75%76%7A%2D%30%31;
filename*6*=%32%33%34%35%36%37%38%39%2D%71%77%65%72%74%79%75%69%6F%70%61;
filename*7*=%73%64%66%67%68%6A%6B%6C%7A%78%63%76%62%6E%6D%6F%70%71%72%73;
filename*8*=%74%75%76%7A%2E%74%78%74
SGkh
--BOUNDARY--

View File

@@ -0,0 +1,9 @@
Content-Type: multipart/mixed;
boundary="BOUNDARY"
--BOUNDARY
Content-Type: application/vnd.ms-excel; name="=?UTF-8?Q?Prost=C5=99eno=5F2014=5Fposledn=C3=AD_voln=C3=A9_term=C3=ADny.xls?="; charset="UTF-8"
Content-Transfer-Encoding: base64
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAACAAAAwgAAAAAA
AAAAEAAA/v///wAAAAD+////AAAAAMAAAADBAAAA////////////////////////////////

View File

@@ -0,0 +1,12 @@
Return-Path: <return-path@here.com>
Subject: test
MIME-Version: 1.0
Content-Type: text/plain
Date: Wed, 27 Sep 2017 12:48:51 +0200
From: from@there.com
To: to@here.com
Bcc: =?UTF-8?B?QV/igqxAe8OoX1o=?= <bcc@here.com>
Reply-To: reply-to@here.com
Sender: sender@here.com
Hi!

View File

@@ -0,0 +1,31 @@
From: from@there.com
To: to@here.com
Subject: Nuu
Date: Wed, 13 Sep 2017 13:05:45 +0200
Content-Type: multipart/mixed; boundary="=-vyqYb0SSRwuGFKv/Trdf"
--=-vyqYb0SSRwuGFKv/Trdf
Content-Type: multipart/alternative; boundary="=-ewUvwipK68Y6itClYNpy"
--=-ewUvwipK68Y6itClYNpy
Content-Type: text/plain; charset="us-ascii"
Here is the problem mail
Body text
--=-ewUvwipK68Y6itClYNpy
Content-Type: text/html; charset="us-ascii"
Here is the problem mail
Body text
--=-ewUvwipK68Y6itClYNpy--
--=-vyqYb0SSRwuGFKv/Trdf
Content-Type: application/pdf; name="Example Domain.pdf"
Content-Disposition: attachment; filename="Example Domain.pdf"
Content-Transfer-Encoding: base64
nnDusSNdG92w6Fuw61fMjAxOF8wMy0xMzMyNTMzMTkzLnBkZg==?=
--=-vyqYb0SSRwuGFKv/Trdf--

View File

@@ -0,0 +1,8 @@
Subject: test
MIME-Version: 1.0
Content-Type: text/plain
Date: %date_raw_header%
From: from@there.com
To: to@here.com
Hi!

View File

@@ -0,0 +1,9 @@
Message-ID: <123@example.com>
From: no_host
Cc: "This one: is \"right\"" <ding@dong.com>, No-address
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi
How are you?

View File

@@ -0,0 +1,63 @@
Return-Path: demo@cerstor.cz
Received: from webmail.my-office.cz (localhost [127.0.0.1])
by keira.cofis.cz
; Fri, 29 Jan 2016 14:25:40 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_5d4b2de51e6aad0435b4bfbd7a23594a"
Date: Fri, 29 Jan 2016 14:25:40 +0100
From: demo@cerstor.cz
To: demo@cerstor.cz
Subject: embedded message
Message-ID: <7e5798da5747415e5b82fdce042ab2a6@cerstor.cz>
X-Sender: demo@cerstor.cz
User-Agent: Roundcube Webmail/1.0.0
--=_5d4b2de51e6aad0435b4bfbd7a23594a
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII;
format=flowed
email that contains embedded message
--=_5d4b2de51e6aad0435b4bfbd7a23594a
Content-Transfer-Encoding: 8bit
Content-Type: message/rfc822;
name=demo.eml
Content-Disposition: attachment;
filename=demo.eml;
size=889
Return-Path: demo@cerstor.cz
Received: from webmail.my-office.cz (localhost [127.0.0.1])
by keira.cofis.cz
; Fri, 29 Jan 2016 14:22:13 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="=_995890bdbf8bd158f2cbae0e8d966000"
Date: Fri, 29 Jan 2016 14:22:13 +0100
From: demo-from@cerstor.cz
To: demo-to@cerstor.cz
Subject: demo
Message-ID: <4cbaf57cb00891c53b32e1d63367740c@cerstor.cz>
X-Sender: demo@cerstor.cz
User-Agent: Roundcube Webmail/1.0.0
--=_995890bdbf8bd158f2cbae0e8d966000
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII;
format=flowed
demo text
--=_995890bdbf8bd158f2cbae0e8d966000
Content-Transfer-Encoding: base64
Content-Type: text/plain;
name=testfile.txt
Content-Disposition: attachment;
filename=testfile.txt;
size=29
IHRoaXMgaXMgY29udGVudCBvZiB0ZXN0IGZpbGU=
--=_995890bdbf8bd158f2cbae0e8d966000--
--=_5d4b2de51e6aad0435b4bfbd7a23594a--

View File

@@ -0,0 +1,61 @@
Received: from webmail.my-office.cz (localhost [127.0.0.1])
by keira.cofis.cz
; Fri, 29 Jan 2016 14:25:40 +0100
From: demo@cerstor.cz
To: demo@cerstor.cz
Date: Fri, 5 Apr 2019 12:10:49 +0200
Subject: embedded_message_subject
Message-ID: <AC39946EBF5C034B87BABD5343E96979012671D40E38@VM002.cerk.cc>
Accept-Language: pl-PL, nl-NL
Content-Language: pl-PL
Content-Type: multipart/mixed;
boundary="_005_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_"
MIME-Version: 1.0
--_005_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_
Content-Type: multipart/alternative;
boundary="_000_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_"
--_000_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_
Content-Type: text/plain; charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
some txt
--_000_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_
Content-Type: text/html; charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
<html>
<p>some txt</p>
</html>
--_000_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_--
--_005_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;
name="file1.xlsx"
Content-Description: file1.xlsx
Content-Disposition: attachment; filename="file1.xlsx"; size=29;
creation-date="Fri, 05 Apr 2019 10:06:01 GMT";
modification-date="Fri, 05 Apr 2019 10:10:49 GMT"
Content-Transfer-Encoding: base64
IHRoaXMgaXMgY29udGVudCBvZiB0ZXN0IGZpbGU=
--_005_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;
name="file2.xlsx"
Content-Description: file2
Content-Disposition: attachment; filename="file2.xlsx"; size=29;
creation-date="Fri, 05 Apr 2019 10:10:19 GMT";
modification-date="Wed, 03 Apr 2019 11:04:32 GMT"
Content-Transfer-Encoding: base64
IHRoaXMgaXMgY29udGVudCBvZiB0ZXN0IGZpbGU=
--_005_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_--

View File

@@ -0,0 +1,141 @@
Return-Path: demo@cerstor.cz
Received: from webmail.my-office.cz (localhost [127.0.0.1])
by keira.cofis.cz
; Fri, 29 Jan 2016 14:25:40 +0100
From: demo@cerstor.cz
To: demo@cerstor.cz
Date: Fri, 5 Apr 2019 13:48:50 +0200
Subject: Subject
Message-ID: <AC39946EBF5C034B87BABD5343E96979012671D9F7E4@VM002.cerk.cc>
Accept-Language: pl-PL, nl-NL
Content-Type: multipart/mixed;
boundary="_008_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_"
MIME-Version: 1.0
--_008_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_
Content-Type: multipart/related;
boundary="_007_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_";
type="multipart/alternative"
--_007_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_
Content-Type: multipart/alternative;
boundary="_000_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_"
--_000_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_
Content-Type: text/plain; charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
TexT
[cid:file.jpg]
--_000_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_
Content-Type: text/html; charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
<html><p>TexT</p></html>=
--_000_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_--
--_007_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_
Content-Type: image/jpeg; name=
"file.jpg"
Content-Description: file.jpg
Content-Disposition: inline; filename=
"file.jpg";
size=54558; creation-date="Fri, 05 Apr 2019 11:48:58 GMT";
modification-date="Fri, 05 Apr 2019 11:48:58 GMT"
Content-ID: <file.jpg>
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==
--_007_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_--
--_008_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_
Content-Type: message/rfc822
Received: from webmail.my-office.cz (localhost [127.0.0.1])
by keira.cofis.cz
; Fri, 29 Jan 2016 14:25:40 +0100
From: demo@cerstor.cz
To: demo@cerstor.cz
Date: Fri, 5 Apr 2019 12:10:49 +0200
Subject: embedded_message_subject
Message-ID: <AC39946EBF5C034B87BABD5343E96979012671D40E38@VM002.cerk.cc>
Accept-Language: pl-PL, nl-NL
Content-Language: pl-PL
Content-Type: multipart/mixed;
boundary="_005_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_"
MIME-Version: 1.0
--_005_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_
Content-Type: multipart/alternative;
boundary="_000_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_"
--_000_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_
Content-Type: text/plain; charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
some txt
--_000_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_
Content-Type: text/html; charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
<html>
<p>some txt</p>
</html>
--_000_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_--
--_005_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;
name="file1.xlsx"
Content-Description: file1.xlsx
Content-Disposition: attachment; filename="file1.xlsx"; size=29;
creation-date="Fri, 05 Apr 2019 10:06:01 GMT";
modification-date="Fri, 05 Apr 2019 10:10:49 GMT"
Content-Transfer-Encoding: base64
IHRoaXMgaXMgY29udGVudCBvZiB0ZXN0IGZpbGU=
--_005_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;
name="file2.xlsx"
Content-Description: file2
Content-Disposition: attachment; filename="file2.xlsx"; size=29;
creation-date="Fri, 05 Apr 2019 10:10:19 GMT";
modification-date="Wed, 03 Apr 2019 11:04:32 GMT"
Content-Transfer-Encoding: base64
IHRoaXMgaXMgY29udGVudCBvZiB0ZXN0IGZpbGU=
--_005_AC39946EBF5C034B87BABD5343E96979012671D40E38VM002emonsn_--
--_008_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;
name="file3.xlsx"
Content-Description: file3.xlsx
Content-Disposition: attachment; filename="file3.xlsx";
size=90672; creation-date="Fri, 05 Apr 2019 11:46:30 GMT";
modification-date="Thu, 28 Mar 2019 08:07:58 GMT"
Content-Transfer-Encoding: base64
IHRoaXMgaXMgY29udGVudCBvZiB0ZXN0IGZpbGU=
--_008_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_
Content-Type: application/x-zip-compressed; name="file4.zip"
Content-Description: file4.zip
Content-Disposition: attachment; filename="file4.zip"; size=29;
creation-date="Fri, 05 Apr 2019 11:48:45 GMT";
modification-date="Fri, 05 Apr 2019 11:35:24 GMT"
Content-Transfer-Encoding: base64
IHRoaXMgaXMgY29udGVudCBvZiB0ZXN0IGZpbGU=
--_008_AC39946EBF5C034B87BABD5343E96979012671D9F7E4VM002emonsn_--

View File

@@ -0,0 +1,56 @@
Return-Path: <someone@domain.tld>
Delivered-To: <someone@domain.tld>
Received: from mx.domain.tld
by localhost (Dovecot) with LMTP id T7mwLn3ddlvKWwAA0J78UA
for <someone@domain.tld>; Fri, 17 Aug 2018 16:36:45 +0200
Received: from localhost (localhost [127.0.0.1])
by mx.domain.tld (Postfix) with ESMTP id B642913BA0BE2
for <someone@domain.tld>; Fri, 17 Aug 2018 16:36:45 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at mx.domain.tld
X-Spam-Flag: NO
X-Spam-Score: 1.103
X-Spam-Level: *
X-Spam-Status: No, score=1.103 required=6.31 tests=[ALL_TRUSTED=-1,
OBFU_TEXT_ATTACH=1, TRACKER_ID=1.102, TVD_SPACE_RATIO=0.001]
autolearn=no autolearn_force=no
Received: from mx.domain.tld ([127.0.0.1])
by localhost (mx.domain.tld [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id L8E9vyX80d44 for <someone@domain.tld>;
Fri, 17 Aug 2018 16:36:39 +0200 (CEST)
Received: from [127.0.0.1] (ip.dynamic.domain.tld [192.168.0.24])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by mx.domain.tld (Postfix) with ESMTPSA id EF01E13BA0BD7
for <someone@domain.tld>; Fri, 17 Aug 2018 16:36:38 +0200 (CEST)
Sender: testsender <someone@domain.tld>
Message-ID: <d3a5e91963cb805cee975687d5acb1c6@swift.generated>
Date: Fri, 17 Aug 2018 14:36:24 +0000
Subject: ogqMVHhz7swLaq2PfSWsZj0k99w8wtMbrb4RuHdNg53i76B7icIIM0zIWpwGFtnk
From: testfrom <someone@domain.tld>
Reply-To: testreply_to <someone@domain.tld>
To: testnameto <someone@domain.tld>
Cc: testnamecc <someone@domain.tld>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="_=_swift_v4_1534516584_32c032a3715d2dfd5cd84c26f84dba8d_=_"
X-Priority: 1 (Highest)
--_=_swift_v4_1534516584_32c032a3715d2dfd5cd84c26f84dba8d_=_
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
n1IaXFkbeqKyg4lYToaJ3u1Ond2EDrN3UWuiLFNjOLJEAabSYagYQaOHtV5QDlZE
--_=_swift_v4_1534516584_32c032a3715d2dfd5cd84c26f84dba8d_=_
Content-Type: application/octet-stream; name=6mfFxiU5Yhv9WYJx.txt
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=6mfFxiU5Yhv9WYJx.txt
em5rNTUxTVAzVFAzV1BwOUtsMWduTEVycldFZ2tKRkF0dmFLcWtUZ3JrM2RLSThkWDM4WVQ4QmFW
eFJjT0VSTg==
--_=_swift_v4_1534516584_32c032a3715d2dfd5cd84c26f84dba8d_=_--

View File

@@ -0,0 +1,96 @@
Return-Path: <>
Received: from somewhere.your-server.de
by somewhere.your-server.de with LMTP
id 3TP8LrElAGSOaAAAmBr1xw
(envelope-from <>); Thu, 02 Mar 2023 05:27:29 +0100
Envelope-to: demo@foo.de
Delivery-date: Thu, 02 Mar 2023 05:27:29 +0100
Authentication-Results: somewhere.your-server.de;
iprev=pass (somewhere06.your-server.de) smtp.remote-ip=1b21:2f8:e0a:50e4::2;
spf=none smtp.mailfrom=<>;
dmarc=skipped
Received: from somewhere06.your-server.de ([1b21:2f8:e0a:50e4::2])
by somewhere.your-server.de with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384
(Exim 4.94.2)
id 1pXaXR-0006xQ-BN
for demo@foo.de; Thu, 02 Mar 2023 05:27:29 +0100
Received: from [192.168.0.10] (helo=sslproxy01.your-server.de)
by somewhere06.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256)
(Exim 4.92)
id 1pXaXO-000LYP-9R
for demo@foo.de; Thu, 02 Mar 2023 05:27:26 +0100
Received: from localhost ([127.0.0.1] helo=sslproxy01.your-server.de)
by sslproxy01.your-server.de with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256)
(Exim 4.92)
id 1pXaXO-0008gy-7x
for demo@foo.de; Thu, 02 Mar 2023 05:27:26 +0100
Received: from Debian-exim by sslproxy01.your-server.de with local (Exim 4.92)
id 1pXaXO-0008gb-6g
for demo@foo.de; Thu, 02 Mar 2023 05:27:26 +0100
X-Failed-Recipients: ding@ding.de
Auto-Submitted: auto-replied
From: Mail Delivery System <Mailer-Daemon@sslproxy01.your-server.de>
To: demo@foo.de
Content-Type: multipart/report; report-type=delivery-status; boundary=1677731246-eximdsn-678287796
MIME-Version: 1.0
Subject: Mail delivery failed
Message-Id: <E1pXaXO-0008gb-6g@sslproxy01.your-server.de>
Date: Thu, 02 Mar 2023 05:27:26 +0100
X-Virus-Scanned: Clear (ClamAV 0.103.8/26827/Wed Mar 1 09:28:49 2023)
X-Spam-Score: 0.0 (/)
Delivered-To: bar-demo@foo.de
--1677731246-eximdsn-678287796
Content-type: text/plain; charset=us-ascii
This message was created automatically by mail delivery software.
A message sent by
<info@foo.de>
could not be delivered to one or more of its recipients. The following
address(es) failed:
ding@ding.de
host 36.143.65.153 [36.143.65.153]
SMTP error from remote mail server after pipelined end of data:
550-Verification failed for <info@foo.de>
550-Unrouteable address
550 Sender verify failed
--1677731246-eximdsn-678287796
Content-type: message/delivery-status
Reporting-MTA: dns; sslproxy01.your-server.de
Action: failed
Final-Recipient: rfc822;ding@ding.de
Status: 5.0.0
Remote-MTA: dns; 36.143.65.153
Diagnostic-Code: smtp; 550-Verification failed for <info@foo.de>
550-Unrouteable address
550 Sender verify failed
--1677731246-eximdsn-678287796
Content-type: message/rfc822
Return-path: <info@foo.de>
Received: from [31.18.107.47] (helo=127.0.0.1)
by sslproxy01.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256)
(Exim 4.92)
(envelope-from <info@foo.de>)
id 1pXaXO-0008eK-11
for ding@ding.de; Thu, 02 Mar 2023 05:27:26 +0100
Date: Thu, 2 Mar 2023 05:27:25 +0100
To: ding <ding@ding.de>
From: =?iso-8859-1?Q?S=C3=BCderbar_Foo_=28SI=29_GmbH?= <info@foo.de>
Subject: Test
Message-ID: <UyVznI5nOyYGnv7Ij0hi6ro4gvxwGT999eQAtc4o@127.0.0.1>
X-Mailer: PHPMailer 6.7.1 (https://github.com/PHPMailer/PHPMailer)
Return-Path: bounce@foo.de
MIME-Version: 1.0
Content-Type: text/html; charset=iso-8859-1
X-Authenticated-Sender: demo@foo.de
<div class="some_class"><strong>Hallo</strong>, <i>dies</i> ist ein Beispiel-Text.</div>

View File

@@ -0,0 +1,69 @@
To: test@example.com
From: test@example.com
Subject: 3-third-subject
Content-Type: multipart/mixed;
boundary="------------2E5D78A17C812FEFF825F7D5"
This is a multi-part message in MIME format.
--------------2E5D78A17C812FEFF825F7D5
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
3-third-content
--------------2E5D78A17C812FEFF825F7D5
Content-Type: message/rfc822;
name="2-second-email.eml"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="2-second-email.eml"
To: test@example.com
From: test@example.com
Subject: 2-second-subject
Content-Type: multipart/mixed;
boundary="------------9919377E37A03209B057D47F"
This is a multi-part message in MIME format.
--------------9919377E37A03209B057D47F
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
2-second-content
--------------9919377E37A03209B057D47F
Content-Type: message/rfc822;
name="1-first-email.eml"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="1-first-email.eml"
To: test@example.com
From: test@example.com
Subject: 1-first-subject
Content-Type: multipart/mixed;
boundary="------------0919377E37A03209B057D47A"
This is a multi-part message in MIME format.
--------------0919377E37A03209B057D47A
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
1-first-content
--------------0919377E37A03209B057D47A
Content-Type: message/rfc822;
name="0-zero-email.eml"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="0-zero-email.eml"
To: test@example.com
From: test@example.com
Subject: 0-zero-subject
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
0-zero-content
--------------0919377E37A03209B057D47A--
--------------9919377E37A03209B057D47F--
--------------2E5D78A17C812FEFF825F7D5--

View File

@@ -0,0 +1,9 @@
From: from@there.com
To: to@here.com
Subject: Nuu
Date: Wed, 13 Sep 2017 13:05:45 +0200
Content-Type: text/plain;
charset="X-GBK"
Content-Transfer-Encoding: quoted-printable
Hi

View File

@@ -0,0 +1,9 @@
From: from@there.com
To: to@here.com
Subject: Nuu
Date: Wed, 13 Sep 2017 13:05:45 +0200
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html><body>Hi</body></html>

View File

@@ -0,0 +1,9 @@
From: from@there.com
To: to@here.com
Subject: =?UTF-8?B?nnDusSNdG92w6Fuw61fMjAxOF8wMy0xMzMyNTMzMTkzLnBkZg==?=
Date: Wed, 13 Sep 2017 13:05:45 +0200
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi

View File

@@ -0,0 +1,41 @@
Content-Type: multipart/mixed;
boundary="----=_Part_1114403_1160068121.1505882828080"
------=_Part_1114403_1160068121.1505882828080
Content-Type: multipart/related;
boundary="----=_Part_1114404_576719783.1505882828080"
------=_Part_1114404_576719783.1505882828080
Content-Type: text/html;charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<img style=3D"height: auto;" src=3D"cid:ii_15f0aad691bb745f" border=3D"0"/>
------=_Part_1114404_576719783.1505882828080
Content-Type: image/png
Content-Disposition: inline
Content-Transfer-Encoding: base64
Content-ID: <ii_15f0aad691bb745f>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAB+FBMVEUAAAA/mUPidDHiLi5Cn0Xk
NTPmeUrkdUg/m0Q0pEfcpSbwaVdKskg+lUP4zA/iLi3msSHkOjVAmETdJSjtYFE/lkPnRj3sWUs8
kkLeqCVIq0fxvhXqUkbVmSjwa1n1yBLepyX1xxP0xRXqUkboST9KukpHpUbuvRrzrhF/ljbwalju
ZFM4jELaoSdLtElJrUj1xxP6zwzfqSU4i0HYnydMtUlIqUfywxb60AxZqEXaoifgMCXptR9MtklH
pEY2iUHWnSjvvRr70QujkC+pUC/90glMuEnlOjVMt0j70QriLS1LtEnnRj3qUUXfIidOjsxAhcZF
o0bjNDH0xxNLr0dIrUdmntVTkMoyfL8jcLBRuErhJyrgKyb4zA/5zg3tYFBBmUTmQTnhMinruBzv
vhnxwxZ/st+Ktt5zp9hqota2vtK6y9FemNBblc9HiMiTtMbFtsM6gcPV2r6dwroseLrMrbQrdLGd
yKoobKbo3Zh+ynrgVllZulTsXE3rV0pIqUf42UVUo0JyjEHoS0HmsiHRGR/lmRz/1hjqnxjvpRWf
wtOhusaz0LRGf7FEfbDVmqHXlJeW0pbXq5bec3fX0nTnzmuJuWvhoFFhm0FtrziBsjaAaDCYWC+u
Si6jQS3FsSfLJiTirCOkuCG1KiG+wSC+GBvgyhTszQ64Z77KAAAARXRSTlMAIQRDLyUgCwsE6ebm
5ubg2dLR0byXl4FDQzU1NDEuLSUgC+vr6urq6ubb29vb2tra2tG8vLu7u7uXl5eXgYGBgYGBLiUA
LabIAAABsElEQVQoz12S9VPjQBxHt8VaOA6HE+AOzv1wd7pJk5I2adpCC7RUcHd3d3fXf5PvLkxh
eD++z+yb7GSRlwD/+Hj/APQCZWxM5M+goF+RMbHK594v+tPoiN1uHxkt+xzt9+R9wnRTZZQpXQ0T
5uP1IQxToyOAZiQu5HEpjeA4SWIoksRxNiGC1tRZJ4LNxgHgnU5nJZBDvuDdl8lzQRBsQ+s9PZt7
s7Pz8wsL39/DkIfZ4xlB2Gqsq62ta9oxVlVrNZpihFRpGO9fzQw1ms0NDWZz07iGkJmIFH8xxkc3
a/WWlubmFkv9AB2SEpDvKxbjidN2faseaNV3zoHXvv7wMODJdkOHAegweAfFPx4G67KluxzottCU
9n8CUqXzcIQdXOytAHqXxomvykhEKN9EFutG22p//0rbNvHVxiJywa8yS2KDfV1dfbu31H8jF1RH
iTKtWYeHxUvq3bn0pyjCRaiRU6aDO+gb3aEfEeVNsDgm8zzLy9egPa7Qt8TSJdwhjplk06HH43ZN
J3s91KKCHQ5x4sw1fRGYDZ0n1L4FKb9/BP5JLYxToheoFCVxz57PPS8UhhEpLBVeAAAAAElFTkSu
QmCC
------=_Part_1114404_576719783.1505882828080--
------=_Part_1114403_1160068121.1505882828080--

View File

@@ -0,0 +1,123 @@
Received: from AS4PR02MB8234.eurprd02.prod.outlook.com (2603:10a6:20b:4f1::17)
by PA4PR02MB7071.eurprd02.prod.outlook.com with HTTPS; Wed, 18 Jan 2023
09:17:10 +0000
Received: from AS1PR02MB7917.eurprd02.prod.outlook.com (2603:10a6:20b:4a5::5)
by AS4PR02MB8234.eurprd02.prod.outlook.com (2603:10a6:20b:4f1::17) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.19; Wed, 18 Jan
2023 09:17:09 +0000
Received: from AS1PR02MB7917.eurprd02.prod.outlook.com
([fe80::4871:bdde:a499:c0d9]) by AS1PR02MB7917.eurprd02.prod.outlook.com
([fe80::4871:bdde:a499:c0d9%9]) with mapi id 15.20.5986.023; Wed, 18 Jan 2023
09:17:09 +0000
From: =?iso-8859-1?Q?Martin_B=FClow_Larsen?= <xxxxx@feline.dk>
To: Cofman Drift <xxxxxxxxx@cofman.com>
Subject: Test 1017
Thread-Topic: Test 1017
Thread-Index: AdkrHaKsy+bUiL/eTIS5W3AP+zzLjQ==
Date: Wed, 18 Jan 2023 09:17:09 +0000
Message-ID:
<AS1PR02MB791721260DE0273A15AFEC3EB5C79@AS1PR02MB7917.eurprd02.prod.outlook.com>
Accept-Language: da-DK, en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 04
X-MS-Exchange-Organization-AuthSource: AS1PR02MB7917.eurprd02.prod.outlook.com
X-MS-Has-Attach:
X-MS-Exchange-Organization-Network-Message-Id:
98cea1c9-a497-454a-6606-08daf934c6c4
X-MS-Exchange-Organization-SCL: -1
X-MS-TNEF-Correlator:
X-MS-Exchange-Organization-RecordReviewCfmType: 0
x-ms-publictraffictype: Email
X-Microsoft-Antispam-Mailbox-Delivery:
ucf:0;jmr:0;auth:0;dest:I;ENG:(910001)(944506478)(944626604)(920097)(425001)(930097);
X-Microsoft-Antispam-Message-Info:
BzqL6hvPyQW0lSkWGop6vQlsIZK48umY74vuKlNgF0pb/H659W+0fuTB+6guqGM0oof00mlzu3gn1pu1R5pUOE2Fb58OqnBEFkB30vVrG6TNsG/6KBtecXkP3FptqO/WRmsxCQx7bK7J2VyS2SbOibqX8mDZhkTrwP1+IA0R9eD0/NvoMqX9GssewUDxSAbaaKdADCuU1dG7qpF8M9tfLDJz+dUL5qZoO+oGINGLLdo2y6Z/F+h3UWv7BXiS4BJKc+jwAng26BUMKmg2VVRdMvc+LbZTovUr9hyEq1orS9fOg1iIV6sPcyIVl3NIEy5bHMYh1d6sUCqvTO1UPSdf7lIvKxSszyKptIPNgioOvFpF9tTHDyKU5p1IiLm5FxW/+kGdPq6ZoTIZVriJoyjx6gWKpPY3vHN6bHUK9mA+LspIYAeuDFFvwkZx2b2Rtw3S99S7zz3eBqv3xlGqJixx/apl4Af7ZaxKFpMj9XZXAQVIv9BA0tIA+1nLByt4dPW4Xzoj3KcBbX5K/HkuR/30Lrq7gRQQDyNYgf5S/MO2MLJqcvnVFPXgVubK6XFu5quDibsZjPjxOUfBTJkJ/n4gB8Z8/TOM0oKD76hszXXoaWd9leUeQ1x88oy+QuXPRxzuLzVec3GiPNMYA42QvvTiWmrrhdceRzhV0J7pJBbi10ik+hXqSeNkldgktd5cWPss5F74yxAaEaPJO9I7MOUpE0XzlRfljPptykrIQt8SARMllykzJNrDt8VAl37ArEZbWxFLm3RuypOI0zgCZMRLf5JeElpCv1ay4wilz4vsYGr4fs3KUQzI1YY43uaDxNMz8k7dH/UkC9Dfg1oyHlNs+w==
Content-Type: multipart/alternative;
boundary="_000_AS1PR02MB791721260DE0273A15AFEC3EB5C79AS1PR02MB7917eurp_"
MIME-Version: 1.0
--_000_AS1PR02MB791721260DE0273A15AFEC3EB5C79AS1PR02MB7917eurp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Test
Med venlig hilsen
Martin Larsen
Feline Holidays A/S
Tlf 78 77 04 12
--_000_AS1PR02MB791721260DE0273A15AFEC3EB5C79AS1PR02MB7917eurp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-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=3Diso-8859-=
1">
<meta name=3D"Generator" content=3D"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;}
@font-face
{font-family:"Lucida Console";
panose-1:2 11 6 9 4 5 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle18
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:3.0cm 2.0cm 3.0cm 2.0cm;}
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=3D"DA" link=3D"#0563C1" vlink=3D"#954F72" style=3D"word-wrap:bre=
ak-word">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Test<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><span style=3D"color:black;mso-fareast-language:DA">=
Med venlig hilsen<o:p></o:p></span></p>
<p class=3D"MsoNormal"><b><span style=3D"color:red;mso-fareast-language:DA"=
>Martin Larsen<o:p></o:p></span></b></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"color:black;mso-fareas=
t-language:DA">Feline Holidays A/S<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"color:black;mso-fareas=
t-language:DA">Tlf 78 77 04 12<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"mso-fareast-language:D=
A"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
</body>
</html>
--_000_AS1PR02MB791721260DE0273A15AFEC3EB5C79AS1PR02MB7917eurp_--

View File

@@ -0,0 +1,208 @@
Received: from FR0P281MB2649.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:50::12)
by BEZP281MB2374.DEUP281.PROD.OUTLOOK.COM with HTTPS; Tue, 17 Jan 2023
09:25:19 +0000
Received: from DB6P191CA0002.EURP191.PROD.OUTLOOK.COM (2603:10a6:6:28::12) by
FR0P281MB2649.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:50::12) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.5986.23; Tue, 17 Jan 2023 09:25:18 +0000
Received: from DB5EUR02FT011.eop-EUR02.prod.protection.outlook.com
(2603:10a6:6:28:cafe::3b) by DB6P191CA0002.outlook.office365.com
(2603:10a6:6:28::12) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.19 via Frontend
Transport; Tue, 17 Jan 2023 09:25:18 +0000
Authentication-Results: spf=pass (sender IP is 80.241.56.171)
smtp.mailfrom=*****; dkim=pass (signature was verified)
header.d=jankoppe.de;dmarc=pass action=none
header.from=jankoppe.de;compauth=pass reason=100
Received-SPF: Pass (protection.outlook.com: domain of **** designates
80.241.56.171 as permitted sender) receiver=protection.outlook.com;
client-ip=80.241.56.171; helo=mout-p-201.mailbox.org; pr=C
Received: from ****
DB5EUR02FT011.mail.protection.outlook.com (10.13.58.70) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id
15.20.6002.13 via Frontend Transport; Tue, 17 Jan 2023 09:25:18 +0000
Received: from ****
(***) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.2375.34; Tue, 17
Jan 2023 10:25:18 +0100
Received: from *****
(***) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.34; Tue, 17 Jan
2023 10:25:16 +0100
Received: from ****
(***) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.2375.34 via Frontend
Transport; Tue, 17 Jan 2023 10:25:16 +0100
Received: from *****
(***) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P521) id 15.1.2375.34; Tue, 17
Jan 2023 10:25:18 +0100
IronPort-SDR: qF6UeVYj8pb73gXrskSNOtfmUEgr2JLTtqbIK+/6ymuIu+hw8DzzyKrOGqm7zNPwG/4zr+ma5y
XERFv6Zyf/cxrWoVjWXswWrkCVjqQuHglLaONZt1Mg4okFzEByeEZsyg3/3n6kI4O+kgViBgLW
nNMzGlNLSqYBX+EDhOfE1GEWB/4iRbwDY32SnTr5BYqR0HwgHf+0M0E3b23/NqV6iYrF3KETah
cLtLRt/b5JY6f5KvmKoz0Y395r7MwryWR1eLKAU2j3w+ioNYBUw36K/hsIRojcquvQk9w3Qtfu
Yz1BUNwOEOwfxr0VjQScHirO
X-IRON-External-Mail-Tag: Extern
X-IronPort-MID: 60840111
X-IPAS-Result: =?us-ascii?q?A0G0CQCSaMZjmKs48VBaglqEBz5Fk0mfZoFqEw8BAQEBA?=
=?us-ascii?q?QEBAQEJRAQBAQQDihcCJToEDQECBAEBAQEDAgMBAQEBBQEBAQQBAQECAQEGA?=
=?us-ascii?q?wEBAQIQAQEBAQEBAQEVCRkFDhAFLw1XDV0LgUQLgXQLAzENgjgiggQsgXYnA?=
=?us-ascii?q?QE4hE6DIwetVIEBgggBAQaCY5xECYFBi12ESYEhHD8BgU2EP4VPhXKaXIE7f?=
=?us-ascii?q?IEnDoFIgSk3A0QdQAMLbQpANRZKKxobB4EJKigVAwQEAwIGEwMiAg0oMRQEK?=
=?us-ascii?q?RMNJyZpCQIDImYDAwQoLQkgHwcmJDwHVj0CDx83BgMJAwIhToEgJAUDCxUqR?=
=?us-ascii?q?wQINgUGUhICCA8SDyxDDkI3NBMGgQYLDhEDUIFOBIENfwpXxUKgLYIqgVChG?=
=?us-ascii?q?oNmAZMikiGXS6gMgXwKFoFcTSQUgyJPAQIBAQENAQIBAQMBAgEBAQkBAQEBj?=
=?us-ascii?q?jaEDIosQzE7AgcLAQEDCYwjAQE?=
IronPort-PHdr: A9a23:3aIm3RBfYL78XRTcz0LxUyQUT0MY04WdBeb1wqQuh78GSKm/5ZOqZ
BWZua8wygaRAM6CsKgMotGVmp6jcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yN
s1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffQVFiCCgbb9uL
Bi6ohjdu8cIjYB/Nqs/1xzFr2dHdOhR2W5mP0+YkQzm5se38p5j8iBQtOwk+sVdT6j0fLk2Q
KJBAjg+PG87+MPktR/YTQuS/XQcSXkZkgBJAwfe8h73WIr6vzbguep83CmaOtD2TawxVD+/4
apnVAPkhSEaPDM/7WrZiNF/jLhDrRyiuhJxw5Dab52aOvRwcazQZs8aSGhbU8pNSyBNHp+wY
o0SBOQBJ+ZYqIz9qkMKoxSkAwmnGebhyjhQhn/uw6IxzuMsERnB3Aw7A9IDq3bUo8/zNKcRV
uC11LHIwivZY/xLxzjw8Y7FeQ0urv+QR7x/a9bRyVUxGAPfiFWdsZDpMjKV2OkTvWWV7+RtW
OOhhmMmqAx8oDuiy8Uih4fGh48Y1FPJ+Th4zYs6J9C0VFJ3bN64HZZftiyXKoR7Tt4kTmp1u
yg60qULtJ2ncCQQ1pgqyAPTZ+aHfoWJ+B7vSeScLSp+iXl4YrywnQyy/lKlyuDkVsm7zlJKr
i1dn9nJsXANygDT5tGfSvdk4EutxSuD2xrW6u5eIEA0kbHUK5kuw7IqkZoTq0vDEjf3mEXwk
qCWal0p9+u05+j9fLnrqYKQO5V0hwz/KKgih86yDfkgPggLRWeb+OC81LP5/U3+RbVHluU2k
q7CsJDGPskbpLS2AwlW0oYk8xa/Fymp3M4FknYZNF5FfgmIgJDzO17SOPD4Eeu/g1O0nTt23
/zGJKHuAo3RLnjfl7fsZbJ960lTyAoyy9BT/olUCqwZIPLrXU/xrsDYAwQiPAyp2eboFc9y2
poQWWKIGK+YPrndsUWV6e41PuaDetxdhDGoL/8q5virlmIhgVgHYYGjwIEbYTW2Ge55Kl+VJ
3bh0fkbFmJfnAM4BM/tkEWPGWpLYG2ud6A14DI8EJqrS4vOENP+yIed1Tu2S8UFLltNDUqBR
C+ASg==
IronPort-Data: A9a23:VhC+4aKGZF33Q9F0FE+RvpMlxSXFcZb7ZxGr2PjKsXjdYENS1zBVm
zYfDDuGOvjcMGT0etAkYN6x8kwD7MLQm9Q3G1ForCE8RH9jl5HIVI+TRqvSF3rJd5WcFiqLz
Cm/hv3odp1coqr0/E/F3oAMLhCQ7InQLlbGILes1htZGEk1F0/NtTo5w7Ri2tcx3oDga++wk
YqaT/P3aQfNNwFcbzp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMebS4K8bhL
wr15ODjpz2Bp3/BPfv++lrzWhVirrc/pmFigFIOM0SpqkAqSiDfTs/XnRfTAKtao2zhojx/9
DlCnZWXSl0jF72Qo9YUcCEfFTpSP4Rt/KCSdBBTseTLp6HHW37r3ukrFARsZdRe/+92BWtJ5
bofMj9lghKr17rwmu7iDLQywJ18daEHP6tH0p1k5SneFuoOQ5nFQKLS/dIe0DpYasVmQ66OO
5JAMGMHgBLoWwRwMVsFObICo/qFn1bzdyRihGDOnP9ii4TU5Fcojeaxb4O9lsaxbcFSkUee4
3nb53z+GA0yPsGFxTPA/HW2mebVkWX3Veov+KaQ8/l3nBiLgzZLUVsTXFq/q/6pzEmkVLqzN
nD45AIniqto/mW7EuLPVj6A53ifkhw1cN5PRrhSBB629oLY5AOQB24hRzFHacA7uMJeeQHGx
mNljPu0X2E06uT9pWa1r+zI9WroUcQABTVaDRLoWzfp9PHPjenfZDrlQ8xnEajdYjbdQGmpm
mHiQMQWo7wVgYYh2r+//Favvt5Bjp3OUxJw/kCNBjvj6wp4YISid8qv81ezARd8wGSxEQXpU
JsswZL2AAUy4XelyHzlrAIlQejB2hp9GGeA6WOD5rF4n9hXx1atfJpL/BZ1L1pzP8APdFfBO
RGM4lMAv88JYiL6Ncebhr5d7ex0ncAM8vy6DpjpgiZmO/CdiSfcrH02DaJu9zmyziDAbp3Ty
b/AKJvyUSlDYUiW5Dq7RuEZ3L4tgzsj3XvUX4yzwBGt0dKjiI29Ft843K+1Rrlhtsus+VyNm
/4Gbpfi40gBDIXWP3eGmaZNdgpiBSZgWvjLRzl/K7TrzvxOQj9xUpc8ANoJJuRYokiivryZo
S/lAxEGmAGXaL+uAVziV02PoYjHBf5XxU/X9wR1Vbpx83R8M4up8okFcJ47Iesu+OB5lKcmT
fADeMKYGvkJRjmeo2YRapz0rYpDchW3hFvQYHP+PWViJsBtF17T59vpXgrz7y1SXCC5gs1v8
bSv2zTSTYcHWwk/Xt3db+iizg3tsHVEwLByUkLEL8N9YkLp9IQ2eSX9guVuepMOIBPAwSOC2
kCaDE5A9+XKpoY09vjPhLyF9tn2SrAjQxcDQWSCtOS4LyjX+Gan0LRsaufQcGCPTn7w9YWje
f5Rk6P2PsoBzQRDvIdLGrp2yb4zuon0rLhAwwU6QHjGYgj5Cr5kJXXaj8BDurcXnO1cvhaqH
1rKoIEDf7CAOcfvF05XIxAqN7zR2fYRkzjUzPI0PESjunAup+faDBwMMknekjFZIZt0LJghn
bUrtvkQul62hRcdO9qbijxZqjaXJXsaXqR56pwXXN3xhgwwxg0QaJDQEHWsspSIdskJKgxwe
mbSgaPDg75b1gzFaXVqTSrB2u9UhJIvvhFWzQZceA3Sx4eY36E6jE9L7DA6bgVJ1REbgeh9D
W46ZUR6KJKH8ypsmMUeDXunHBtMBUPF90H8o7fTeLY1k6V1uqfxwKHR9ApDEI31M46RQ9SDw
Iyl9Q==
IronPort-HdrOrdr: A9a23:8y8NqqHssZLZ5JoIpLqE88eALOsnbusQ8zAXPidKKSC9E/b4qy
nKpp4mPHDP+VUssR0b9uxoW5PwI080l6QZ3WB5B97LNzUO01HFEGgN1+Xf/wE=
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-AV: E=Sophos;i="5.97,222,1669071600";
d="scan'208";a="60840111"
X-Amp-Result: SKIPPED(no attachment in message)
Received: from mout-p-201.mailbox.org ([80.241.56.171])
by maila.burda.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2023 10:25:16 +0100
Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4Nx3QJ6GdJz9sQp
for <***>; Tue, 17 Jan 2023 10:25:12 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=****; s=MBO0001;
t=1673947512;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=OMh+Pfp7SvIiDJjyXg53DevMPfaJRBhjQUkokwQIgDY=;
b=m3nM2KPbJdO7D+Vq/fMLLCXpkeDgvLs/JRzGTzWO4OoQhSaXLp76/vkBGPCU7BSGxir2Fu
g6e9Ggnrf0l8vL7rpvTgttta64wImaP9wOmJ0fOjzHcg/PX7sYjlUjyVyfThqZ7M5qg6/P
E9wItt4lQoUeQRVc6EoUlUaL7S+2R4P2WsQ6HCjulmpC3fmZdPOTXph/a1YfGvSfSj0pjp
LauH2n6EURKFmtMv8MbDcvTVKcq7o1bLGnK/RAjkLmRAORt+eC08IEAb5stVE6T6UPZ14Q
GUqrK2HEm5THS9vlH/11LwxwmnAdqUm8nl+Ymo3n1UNF9r8wkh8BUndGQFOQqQ==
Message-ID: <****>
Subject: Testing 123
From: ****
To: ***
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Date: Tue, 17 Jan 2023 10:25:11 +0100
Return-Path: ***
X-OrganizationHeadersPreserved: ***
X-MS-Exchange-Organization-ExpirationStartTime: 17 Jan 2023 09:25:18.2389
(UTC)
X-MS-Exchange-Organization-ExpirationStartTimeReason: OriginalSubmit
X-MS-Exchange-Organization-ExpirationInterval: 1:00:00:00.0000000
X-MS-Exchange-Organization-ExpirationIntervalReason: OriginalSubmit
X-MS-Exchange-Organization-Network-Message-Id:
ca3e116b-7c15-4efe-897e-08daf86cbfae
X-EOPAttributedMessage: 0
X-MS-Exchange-Organization-MessageDirectionality: Originating
X-MS-Exchange-SkipListedInternetSender:
ip=[80.241.56.171];domain=mout-p-201.mailbox.org
X-MS-Exchange-ExternalOriginalInternetSender:
ip=[80.241.56.171];domain=mout-p-201.mailbox.org
X-CrossPremisesHeadersPromoted:
DB5EUR02FT011.eop-EUR02.prod.protection.outlook.com
X-CrossPremisesHeadersFiltered:
DB5EUR02FT011.eop-EUR02.prod.protection.outlook.com
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DB5EUR02FT011:EE_|FR0P281MB2649:EE_
X-MS-Exchange-Organization-AuthSource: ****
X-MS-Exchange-Organization-AuthAs: Anonymous
X-OriginatorOrg: ***
X-MS-Office365-Filtering-Correlation-Id: ca3e116b-7c15-4efe-897e-08daf86cbfae
X-MS-Exchange-Organization-SCL: 1
X-Microsoft-Antispam: BCL:0;
X-Forefront-Antispam-Report:
CIP:193.26.100.144;CTRY:DE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mout-p-201.mailbox.org;PTR:mout-p-201.mailbox.org;CAT:NONE;SFS:(13230022)(4636009)(451199015)(6916009)(82310400005)(558084003)(2616005)(7116003)(6266002)(36005)(8676002)(86362001)(36756003)(5660300002)(1096003)(336012)(8936002)(156005)(7636003)(7596003);DIR:INB;
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 09:25:18.1452
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: ca3e116b-7c15-4efe-897e-08daf86cbfae
X-MS-Exchange-CrossTenant-Id: 0a3106bb-aab1-42df-9639-39f349ecd2a0
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0a3106bb-aab1-42df-9639-39f349ecd2a0****
X-MS-Exchange-CrossTenant-AuthSource: ***
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: FR0P281MB2649
X-MS-Exchange-Transport-EndToEndLatency: 00:00:01.4839051
X-MS-Exchange-Processed-By-BccFoldering: 15.20.6002.012
X-Microsoft-Antispam-Mailbox-Delivery:
ucf:0;jmr:0;auth:0;dest:I;ENG:(910001)(944506478)(944626604)(920097)(930097);
X-Microsoft-Antispam-Message-Info:
=?iso-8859-1?Q?DN6oyY29jzFhRK1BGCOfg1yFnX4ACBaHBh9nbhnIoNZ4DGdi6zN+tIXnUR?=
=?iso-8859-1?Q?AY3F6SV1doOncexZBgqeE70YqvkB0xmo97NgnkQFb48xPvmZwoiAqkmIrS?=
=?iso-8859-1?Q?EbPesMMRL/pVX22Pde2C0KNThL0e02Li5ZCNvDxq+mEt0T9cww7HhoY6SS?=
=?iso-8859-1?Q?vMbDIBDA4c6Gyvb+34A6rYNFyHtZFVMas8S1KP4bV7QtI2WooRBzL1tOgM?=
=?iso-8859-1?Q?gyRVbzR69Mk++hTLhqTK7kBIkGMFhUC1McOMGMTOuUh9Ay7vMeY/oNGwOG?=
=?iso-8859-1?Q?WEFVsQjOz6lY4FIc3A+U5t3LMxkHtxRCql//ZhfKfjy78hPR7FCzYk70+T?=
=?iso-8859-1?Q?iCLlDZNF73KjvxH82FFKOersAl26L1kb2x5F/d1XJxAJe7BTG20/LXuMmx?=
=?iso-8859-1?Q?wGJs7s+C69LYa4cliwtGTMEuS6Rd7bOLihXnIy6hn8UhjVhNBv0+yGjint?=
=?iso-8859-1?Q?hbwBnQJ4Ny2jeS42bJYmKw+7Dnol+pphbvhjhtsDvKifo4Xx7xM45eV2s3?=
=?iso-8859-1?Q?wfKtSfeNGIR3Oi0VwreHTtsCOfvY8jbP+T2Z6KOFtQRvlUyutOFnOB2x1J?=
=?iso-8859-1?Q?BVgSblJzekltOB7gCAmZiCQnZuUMOtVVqRfURwUhOuQ47I/2LDJzi/NQnf?=
=?iso-8859-1?Q?XiqeHojof9SfngGas5TNx9tuQxmFqw4AWJE7iy4hxJo2ehSt4ReEvPzyt9?=
=?iso-8859-1?Q?1DTwLNYbyZ8Ub7Uq3EtUDE5vn3jY2thuVBo8eemdrjOvsx+hdH9RxcFwYz?=
=?iso-8859-1?Q?qU8NIflZ0TMRHTT2M2aBdzB9zsR3Kda+I8tNi7T6DCWve+MEEmLeRa4lU6?=
=?iso-8859-1?Q?XAFgPATiTR9BGrBBrwqKLye2Pnn6Bx8Hs+R7sFsv6HnQkS8B585+mjXV0A?=
=?iso-8859-1?Q?jXMm+5KDT/IUTiTAeJPwBTNEAG6Yo8gDg+6/9EMuZtQYAYZnM4tMefCwBm?=
=?iso-8859-1?Q?oV/M1vLbCGr7m1BDeRerH34C/2SWa0XnU9zOzqvm6/ery2Cv81aakjQr+S?=
=?iso-8859-1?Q?FdFwyYhZi96v0+HHAeT1Ncyrb84GZVp0kb1VYOBI0JH7TTZy88PMtFfbXQ?=
=?iso-8859-1?Q?nrSZ/VgrVa7hCvBOf2VQnj6iMnNqaJlmnI+E/yXvDNQJn2JDhor7QrClSA?=
=?iso-8859-1?Q?rrCXMDZyWWZhhDrf+VkN7ePKkju46/dqh0NRjqz6571xFdftnXx/b9dli1?=
=?iso-8859-1?Q?+XoZOiqbV8FyrJNCWDLuZRc1gIr0KVbbxN9nggMGa5c8tslnJvW/OTImm7?=
=?iso-8859-1?Q?SEKOX/bZx/aOe9bLlgzQhqdtwBkOJurGSWeDajB/ko2pFUcIYWyMaB6dFW?=
=?iso-8859-1?Q?RcQgdjWDgNNqiUnyvY585ZCFJCfiMaWj8hglJWADRQdLHNSqFAtuZdVCc1?=
=?iso-8859-1?Q?HPXeZDkLqPP+0VfD8EO3A1Fmp+E3kIrykjPJtNslbzwmtL3ATsC8e2mcob?=
=?iso-8859-1?Q?NGBKDmktRjDYG3mhya2XCCiFWaYiig6J/s1ePtuRp3TbBojEAUg2E5xItx?=
=?iso-8859-1?Q?gRGc6bNfg9Rihie4+BZSN+l+ynuYJQ/FGK3CvQYA9gXp00ZtfPwlHx7mXA?=
=?iso-8859-1?Q?gaDydNv1CyuYCOgUeTxo4Bi7N4Rrz72tn9pYxoZ7okujjzLWuiK7etRoRz?=
=?iso-8859-1?Q?JwOHGQklwT4VgMwwLQdXxNR+WMLbOyXjt6bfrKSUHq34oLx6ZVk2F6r9HI?=
=?iso-8859-1?Q?5uaCMLO8dLt3O9rb8FdV3EfLGg+zThKobHlrVJ2WFZLm0xtSsbzC04WLdR?=
=?iso-8859-1?Q?Oqf0F2GVBbFjulBFs9mvdhDXD33oUn5atsgLnkAitzWZH8qgeTOKgCbZD4?=
=?iso-8859-1?Q?WIXnz+DQx0g6sgmqGwa5fkPzRn+NfdGnwNwRyjXcAw7jW5DVkAnzd2OkEc?=
=?iso-8859-1?Q?WrVWN1eIbPedT77yCWDwLAjGBWSrpmI1bZkqI=3D?=
MIME-Version: 1.0
Asdf testing123 this is a body

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
From: MAILER-DAEMON@mta-09.someserver.com (Mail Delivery System)
To: to@here.com
Subject: Test
Date: Wed, 13 Sep 2017 13:05:45 +0200
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi

View File

@@ -0,0 +1,9 @@
From: from@there.com
To: to@here.com
Subject: 1;00pm Client running few minutes late
Date: Wed, 13 Sep 2017 13:05:45 +0200
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi

View File

@@ -0,0 +1,16 @@
From: from@there.com
To: to@here.com
Subject: =?ISO-2022-JP?B?GyRCIXlCaBsoQjEzMhskQjlmISEhViUsITwlRyVzGyhCJhskQiUoJS8lOSVGJWolIiFXQGxMZ0U5JE4kPyRhJE4jURsoQiYbJEIjQSU1JW0lcyEhIVo3bjQpJSglLyU5JUYlaiUiISYlbyE8JS8hWxsoQg==?=
Date: Wed, 13 Sep 2017 13:05:45 +0200
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="------------B832AF745285AEEC6D5AEE42"
Hi
--------------B832AF745285AEEC6D5AEE42
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="=?ISO-2022-JP?B?GyRCIXlCaBsoQjEzMhskQjlmISEhViUsITwlRyVzGyhCJhskQiUoJS8lOSVGJWolIiFXQGxMZ0U5JE4kPyRhJE4jURsoQiYbJEIjQSU1JW0lcyEhIVo3bjQpJSglLyU5JUYlaiUiISYlbyE8JS8hWxsoQg==?="
SGkh
--------------B832AF745285AEEC6D5AEE42--

View File

@@ -0,0 +1,22 @@
From: from@there.com
To: to@here.com
Subject: =?iso-8859-1?Q?386_-_400021804_-_19.,_Heiligenst=E4dter_Stra=DFe_80_-_081?=
=?iso-8859-1?Q?9306_-_Anfrage_Vergabevorschlag?=
Date: Wed, 13 Sep 2017 13:05:45 +0200
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="------------B832AF745285AEEC6D5AEE42"
Hi
--------------B832AF745285AEEC6D5AEE42
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;
name="=?iso-8859-1?Q?2021=5FM=E4ngelliste=5F0819306.xlsx?="
Content-Description: =?iso-8859-1?Q?2021=5FM=E4ngelliste=5F0819306.xlsx?=
Content-Disposition: attachment;
filename="=?iso-8859-1?Q?2021=5FM=E4ngelliste=5F0819306.xlsx?="; size=11641;
creation-date="Mon, 10 Jan 2022 09:01:00 GMT";
modification-date="Mon, 10 Jan 2022 09:01:00 GMT"
Content-Transfer-Encoding: base64
SGkh
--------------B832AF745285AEEC6D5AEE42--

View File

@@ -0,0 +1,216 @@
Return-Path: <tonymarston@hotmail.com>
Delivered-To: gmx@tonymarston.co.uk
Received: from ion.dnsprotect.com
by ion.dnsprotect.com with LMTP
id YFDRGeZ6d2SlCRUAzEkvSQ
(envelope-from <tonymarston@hotmail.com>)
for <gmx@tonymarston.co.uk>; Wed, 31 May 2023 12:50:46 -0400
Return-path: <tonymarston@hotmail.com>
Envelope-to: gmx@tonymarston.co.uk
Delivery-date: Wed, 31 May 2023 12:50:46 -0400
Received: from mail-vi1eur04olkn2050.outbound.protection.outlook.com ([40.92.75.50]:23637 helo=EUR04-VI1-obe.outbound.protection.outlook.com)
by ion.dnsprotect.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
(Exim 4.96)
(envelope-from <tonymarston@hotmail.com>)
id 1q4P28-005pTm-0E
for gmx@tonymarston.co.uk;
Wed, 31 May 2023 12:50:46 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=SYBG6BEOiWsmVfcgXUQJ0moS1SuG/IdTK6DIT4H3g7CQ+hbWIbItTxOhFzJiHP+q0uz+XzR1FzX2Daso+4iKotX7x2ViHIA0Hs65xUZVFtvflMsUrB+5RLlf3Pr7DiNKguQQtC+R2IBLvedc+IqElnMrTHcxLVS2gWl89MZx5Q0bXGWW/9wBVq6yvc6C69ynppcEdD0QZsoUQlp2DgzDpg8iG3y6dYGxFiTvLzw08nTQiCuqi8qQ+nmHyeeItIiAmyKynvyiL+kh4frcSDS67r6PU/CBxvto/nP3RCAxHuzJEGOpS7LJPqoJAlRSrUp2zpeEMpmDFJUE/Jo0K+EgcQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector9901;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=ISg5C/1AgVASEPkGp/cgowfc/y9qywGvXMTv5yjJffs=;
b=eVYGErUWMxOeFGLg2nPuB0E/ngKet0hEVcN8Ay4ujGFY4k7i+1hrmnOMD6XiaIk3gVrqPalsmDjmEHpS0zV3+fPPTSktlSvkLrUr5ViVI1kMVBbBQsowLD5x3FpX7fnP2q17WPQ2P6R8Ibudkdnei8uq7gZhc3CSDLv4PfNma45H0FmdaB40mF2dCYzj5hEzr6jmMliANHJjznuDEFEUH3CfS1/iIA9rzhBKPKtahipTNeYiLqvZpKo1fO/XkZ57T44fqHkocfCyEK3Y1rehWudmkU8a9eEZlU5nBC6xoGO3P5Q1XIUNEHFmx2HH7eO8IgGzq/vbLMhcvbc3Ysdb2A==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com;
s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=ISg5C/1AgVASEPkGp/cgowfc/y9qywGvXMTv5yjJffs=;
b=Qv71Bx+LsM9Lo0uen0vxQzWI3ju4Q095ZMkKPXDaKsd5Y8dA3QteMpAPhy3/mAdP1+EV8NviDBhamtTG4qMO+zEqu/pyRpBGZOtjyiJGKh7aFh2bbodOkJkiGqH3jPwYBnE7T1XAqDVFmvRpuqIkqBe9FXeCZKRrF/Na5Y+zuklH7ebuGQVzIK+xol6q7BDgb/oLul7Wa3r3Lw40cPW5leUgwxngRFMucUVVO5aJ4MWlk76CmcN8XqgwVcFaACY80HLWRqRZfM8n24/KzV9nKSZIQFCgJi2CiqnEWVRSZZtZ9SudJJv4S3C/gU4OYoiFKr7GkEQibyqE2QkGHCBA1g==
Received: from PAXP193MB2364.EURP193.PROD.OUTLOOK.COM (2603:10a6:102:22b::9)
by DB8P193MB0773.EURP193.PROD.OUTLOOK.COM (2603:10a6:10:15a::10) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.22; Wed, 31 May
2023 16:50:03 +0000
Received: from PAXP193MB2364.EURP193.PROD.OUTLOOK.COM
([fe80::b962:59b:2d33:85c2]) by PAXP193MB2364.EURP193.PROD.OUTLOOK.COM
([fe80::b962:59b:2d33:85c2%5]) with mapi id 15.20.6455.020; Wed, 31 May 2023
16:50:03 +0000
From: Tony Marston <tonymarston@hotmail.com>
To: "gmx@tonymarston.co.uk" <gmx@tonymarston.co.uk>
Subject: RE: TEST MESSAGE
Thread-Topic: TEST MESSAGE
Thread-Index: AQHZjysmbQn8p2cYOEawNV6ywnFmN690oIyAgAAA5rw=
Date: Wed, 31 May 2023 16:50:03 +0000
Message-ID:
<PAXP193MB2364F1160B9E7C559D7D897ABB489@PAXP193MB2364.EURP193.PROD.OUTLOOK.COM>
References:
<PAXP193MB236463D7319FE32F29EB5FF1BB469@PAXP193MB2364.EURP193.PROD.OUTLOOK.COM>
<944a7d16fcb607628f358cdd0f5ba8c0@tonymarston.co.uk>
In-Reply-To: <944a7d16fcb607628f358cdd0f5ba8c0@tonymarston.co.uk>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-messagesentrepresentingtype: 1
x-tmn: [ABOzTq1ytyWYuvBD5A4I78Eqna1hBLeM]
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: PAXP193MB2364:EE_|DB8P193MB0773:EE_
x-ms-office365-filtering-correlation-id: 7fbd6771-9a0d-495d-c4d3-08db61f714a6
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info:
fwWKs8Qs/JyQ+pSnCNC804PQ86JYn/R63U7P6WCeXLC/fVSGqcAnslOc2vbxC2cUeTPPfow1WAz3f73/7Uk+byKxiE6L48WkgL6BFKVkYCwPKcQ3ps6KyEdGL6uUvPqYKwf5gFgUiTt+fKDiR/GJljj6qmN51jd5lUBvLf1g59q3LryUC+lEy6iLQ8cjCivzmBcR+0C2+uaa/xsjJxokbIEQoMicjjUiVWFkxRFBDr6FO8kEQyzzs70pNivK6mcXpVeJSOiLQfYa/2Q5QDYhE8kznG1EYUzHBQD/sLp/maUgmpKj1b8ObeI13QXed1qih+CtdLYAmPs5GPaoz8aY7pmaxroKLjBAqfOAC2IeQ3grxdQ8eRXlrnZ29cQnvD9tDryUvE9nyQLinaM2Dft4MueHvBTL5+WOTNnVQB98zVjnop8iVkwNrBKzPYiox9ufs9XFXNl0+2fFn66647ET7y/DkBKcszTKYF5RRp5o59QAh8rUTsaKeGJkPkyowZd+i6R12NIavL+eOOgnKvziTTbNl1lGgP+3zTKbgbb6K+DxfbKNl1zaTNvonOHwzI3jfdkDRtg5BvZVKstyl9AfZqo6OZ7ii3JKgVquRVWAtEQ6J6tx1Va/nTVrn1478+Dj
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
=?us-ascii?Q?EMaSeqWhMBslXR7KptI34/opub+lBzTReVt3ACHDu/w7NvVUPpdp4YhwogpL?=
=?us-ascii?Q?8V9o/Zj+8vv6zZ7YL0n2NpODi8fzrPScgRiZGtJmfS58OqfgW2yygp1BmawZ?=
=?us-ascii?Q?y99Omv39THENDmCAba4d8zYLikOc+HJUfhpWeb/L9yqut7T2QkPFJYoeN5vU?=
=?us-ascii?Q?LeJ1hoPlguhNnDwMtE3HTgAl0Hbesms0Rb7wGaTDsgAc7XOO+8XpqLamnU0m?=
=?us-ascii?Q?zPpkQXV8+V5dFU2HxgIcYPYSaTX1CLPCdNcCAr1uHPnN81Ntm9Jb7fpYs1oA?=
=?us-ascii?Q?tgzPMwt37Ks9eQucJWZ5LQnNmZl/kYtVnvkylqYYMWiAg3y2XtjVkW/Ut/V2?=
=?us-ascii?Q?6vMfyCB5fEGJrn/uCp+KwL1s7s/4B332Bn4zvwpYd5TioMSGf9Rdp157eAfg?=
=?us-ascii?Q?LiNlLjDFdRc5SSEkUEl1TeX0FOQLsaCsQQqC/hzb10boa49GuxpoKwRmwhAO?=
=?us-ascii?Q?LZ2+veS5Jr1qWngBGo4MTkEq7nD6vBRIXQmKiLMpJc+Gk3/PCADL+H0IRH0+?=
=?us-ascii?Q?4uHnvcVr6CrDDZ2BEwcaWOa/ct8yUI5G9SC5gFP53TaS2llCnYwHAX1PkMAo?=
=?us-ascii?Q?w2LHFHE5I5dtQQJHaWNGMJGYdPmb9dDrksggLWXN+IxsxvFcFNSK2GPaqOMJ?=
=?us-ascii?Q?H4ht1rpqHTlU0uzgjb19gKCCcBdZfIzv118RTjFYG+EX/rsHlNRei/OWdTBF?=
=?us-ascii?Q?xf5cdnap836rQmre5ZoubNsSw2qKSRJhmZH1pCHoCFLtreM1fk7kkVJfkUz5?=
=?us-ascii?Q?ApMa03dEfFvzVv5wvPdWBLiCqzI6z6z8fUmwg2XfvK9Nyxb1AOZoT7JUXnp2?=
=?us-ascii?Q?Me6dTKqGKsBx87Dtny+fANHqgOm+Eo/pBZqyXwN93udbltxPmtNJ84MJJjyx?=
=?us-ascii?Q?vbEiDnMVb4knBO+sBqlKAVUv1F9ZJA2oUTrOD7t1xx6nBmQTgoYN6zsi+dgw?=
=?us-ascii?Q?nPebsl1/6fUy73FWLUKkeA64PeSa00Zi/q53ylXmUZV4Pc+11blKdL8o+p32?=
=?us-ascii?Q?dTD0ndul0WvvpQf8RdYNtGJ/BMurqNfvHq9wJo7Iu4fgTElR50ngwEsr28Bc?=
=?us-ascii?Q?G81pAb2fNhID6ewyOGfj87kqybxUhv1E+4pquh770UagjD1J3rKAUiw1sxWp?=
=?us-ascii?Q?u+FSmd7HKgd2cKJsmMErnQelF3DNozw5d0qdNELXZNO03xlMiADVvhqEJuqc?=
=?us-ascii?Q?uArdsSo2hyApUaiB+dM4Fp+oeiGienEQl64NJ7QFxRb/h96J0iTL3Vp8+8Y?=
=?us-ascii?Q?=3D?=
Content-Type: multipart/alternative;
boundary="_000_PAXP193MB2364F1160B9E7C559D7D897ABB489PAXP193MB2364EURP_"
MIME-Version: 1.0
X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-80ceb.templateTenant
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: PAXP193MB2364.EURP193.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-CrossTenant-Network-Message-Id: 7fbd6771-9a0d-495d-c4d3-08db61f714a6
X-MS-Exchange-CrossTenant-originalarrivaltime: 31 May 2023 16:50:03.3982
(UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8P193MB0773
X-Spam-Status: No, score=-1.6
X-Spam-Score: -15
X-Spam-Bar: -
X-Ham-Report: Spam detection software, running on the system "ion.dnsprotect.com",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
root\@localhost for details.
Content preview: Here is my reply to your reply. Tony Marston From: gmx@tonymarston.co.uk<mailto:gmx@tonymarston.co.uk>
Sent: 31 May 2023 17:46 To: Tony Marston<mailto:tonymarston@hotmail.com>
Subject: Re: TEST MESSAGE
Content analysis details: (-1.6 points, 8.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
[score: 0.0005]
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
provider
[tonymarston[at]hotmail.com]
-0.0 SPF_PASS SPF: sender matches SPF record
0.5 SUBJ_ALL_CAPS Subject is all capitals
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
0.0 HTML_MESSAGE BODY: HTML included in message
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
author's domain
0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily
valid
-0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
envelope-from domain
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
-0.0 T_SCC_BODY_TEXT_LINE No description available.
X-Spam-Flag: NO
X-From-Rewrite: unmodified, no actual sender determined from check mail permissions
--_000_PAXP193MB2364F1160B9E7C559D7D897ABB489PAXP193MB2364EURP_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Here is my reply to your reply.
Tony Marston
From: gmx@tonymarston.co.uk<mailto:gmx@tonymarston.co.uk>
Sent: 31 May 2023 17:46
To: Tony Marston<mailto:tonymarston@hotmail.com>
Subject: Re: TEST MESSAGE
On 2023-05-25 13:06, Tony Marston wrote:
Here is my reply to your message
> Tony Marston
--_000_PAXP193MB2364F1160B9E7C559D7D897ABB489PAXP193MB2364EURP_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:sc=
hemas-microsoft-com:office:word" xmlns:m=3D"http://schemas.microsoft.com/of=
fice/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=3D"Generator" content=3D"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;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang=3D"EN-GB" link=3D"blue" vlink=3D"#954F72" style=3D"word-wrap:bre=
ak-word">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Here is my reply to your reply.</p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Tony Marston<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<div style=3D"mso-element:para-border-div;border:none;border-top:solid #E1E=
1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class=3D"MsoNormal" style=3D"border:none;padding:0cm"><b>From: </b><a hr=
ef=3D"mailto:gmx@tonymarston.co.uk">gmx@tonymarston.co.uk</a><br>
<b>Sent: </b>31 May 2023 17:46<br>
<b>To: </b><a href=3D"mailto:tonymarston@hotmail.com">Tony Marston</a><br>
<b>Subject: </b>Re: TEST MESSAGE</p>
</div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">On 2023-05-25 13:06, Tony Marston wrote:<br>
Here is my reply to your message<br>
&gt; Tony Marston<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</body>
</html>
--_000_PAXP193MB2364F1160B9E7C559D7D897ABB489PAXP193MB2364EURP_--

View File

@@ -0,0 +1,32 @@
Return-Path: <radicore@radicore.org>
Delivered-To: gmx@tonymarston.co.uk
Received: from ion.dnsprotect.com
by ion.dnsprotect.com with LMTP
id oPy8IzIke2Rr4gIAzEkvSQ
(envelope-from <radicore@radicore.org>)
for <gmx@tonymarston.co.uk>; Sat, 03 Jun 2023 07:29:54 -0400
Return-path: <radicore@radicore.org>
Envelope-to: gmx@tonymarston.net
Delivery-date: Sat, 03 Jun 2023 07:29:54 -0400
Received: from [::1] (port=48740 helo=ion.dnsprotect.com)
by ion.dnsprotect.com with esmtpa (Exim 4.96)
(envelope-from <radicore@radicore.org>)
id 1q5PSF-000nPQ-1F
for gmx@tonymarston.net;
Sat, 03 Jun 2023 07:29:54 -0400
MIME-Version: 1.0
Date: Sat, 03 Jun 2023 07:29:54 -0400
From: radicore <radicore@radicore.org>
To: gmx@tonymarston.net
Subject: Test Message
User-Agent: Roundcube Webmail/1.6.0
Message-ID: <d0ac7f3d4ffc4d3f01ab38e92fc001ed@radicore.org>
X-Sender: radicore@radicore.org
Content-Type: text/plain; charset=US-ASCII;
format=flowed
Content-Transfer-Encoding: 7bit
X-From-Rewrite: unmodified, already matched
This is just a test, so ignore it (if you can!)
Tony Marston

View File

@@ -0,0 +1,27 @@
From: from@there.com
To: to@here.com
Subject: Test
Date: Fri, 29 Sep 2017 10:55:23 +0200
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="------------5B1F217006A67C28E756A62E"
This is a multi-part message in MIME format.
--------------5B1F217006A67C28E756A62E
Content-Type: text/plain; charset=UTF-8;
name="../../example/MyFile.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="../../example/MyFile.txt"
TXlGaWxlQ29udGVudA==
--------------5B1F217006A67C28E756A62E
Content-Type: text/plain; charset=UTF-8;
name="php://foo"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="php://foo"
TXlGaWxlQ29udGVudA==
--------------5B1F217006A67C28E756A62E--

View File

@@ -0,0 +1,10 @@
Subject: =?ks_c_5601-1987?B?UkU6IMi4v/i01LKyIEVyc2m01MDMILjevcPB9rimILq4s8K9wLTP?=
=?ks_c_5601-1987?B?tNku?=
MIME-Version: 1.0
Content-Type: text/plain
Date: Wed, 27 Sep 2017 12:48:51 +0200
Thread-Topic: =?ks_c_5601-1987?B?yLi/+LTUsrIgRXJzabTUwMwguN69w8H2uKYgurizwr3AtM+02S4=?=
From: =?ks_c_5601-1987?B?seggx/bB+A==?= <from@there.com>
To: to@here.com
Content

View File

@@ -0,0 +1,28 @@
Sender: xxx@yyy.cz
MIME-Version: 1.0
Message-ID: <2244696771454641389@google.com>
Date: Sun, 15 Feb 2015 10:21:51 +0000
Subject: Report domain: yyy.cz Submitter: google.com Report-ID: 2244696771454641389
From: noreply-dmarc-support via xxx <xxx@yyy.cz>
To: xxx@yyy.cz
Content-Type: application/zip;
name="google.com!yyy.cz!1423872000!1423958399.zip"
Content-Disposition: attachment;
filename="google.com!yyy.cz!1423872000!1423958399.zip"
Content-Transfer-Encoding: base64
Reply-To: noreply-dmarc-support@google.com
UEsDBAoAAAAIABRPT0bdJB+DSwIAALgKAAAuAAAAZ29vZ2xlLmNvbSFzdW5mb3guY3ohMTQyMzg3
MjAwMCExNDIzOTU4Mzk5LnhtbO1WwY6bMBC971dEuQcDIQSQQ3rqF7RnZIwh7oJt2WY32a+viQ2h
u9moqnarqOop8Gbmjd/4OQbuj127eCJSUc52y8DzlwvCMK8oa3bL79++rpLlYp8/wJqQqkT4MX9Y
LKAkgktddESjCmk0YAblsikY6kjecN60xMO8g2ACbQ7pEG1zxg1De1pVHZJ4pXox0H2Zl9k8V3PU
EhWYM42wLiireX7QWmQAuErvUgkQKCkDiKlnIj1x2tunXRjF8SbxDfFbMtvFaaJVHoZRFKfxdhtE
myiOgnWSQnAJ23SjmxQSscYpM1BJGsryIArXyTb0fdPMImOcsOocTTfJOjWUw7slA7+yTd3mA4aC
txSfCtGXLVUHMi2Em1GxXPVGytHDL4bMIjaMqkfa5RIC++BAJeozNvxaSOSS/CBYQyAcoi6QGjGB
dR4MyoaH80qvrcrMEnM5LlDy52kEivcSk4KKPIz9bVYnpZ9Fvr/OsB9kWbgOTa8pZSzCvGemLQT2
YYRdZ/KE2t6MrxoDw0yoElxRbTxtvMaImckMmeUNIxFIKZMwTceJr11gGtFM7aueZr9GjZBWhGla
U3OiprIDQRWRRS15N9+nOex43lRD1OtDIYnqW30hfLXY2xZw7h4YnCT3Mqma08GZ3g+gvhgMvFYy
JI82+R3HpL4XbDdesIm84SB/tE9Gr99wSm3+k646xQbu0Sl/uptW0Sfu5tXzH6b3dP7vd1f/+vl/
KU83eRnpzbX6uY5JzMeJZ25PLwji920S/r8m/tVrAoLLR+hPUEsBAgoACgAAAAgAFE9PRt0kH4NL
AgAAuAoAAC4AAAAAAAAAAAAAAAAAAAAAAGdvb2dsZS5jb20hc3VuZm94LmN6ITE0MjM4NzIwMDAh
MTQyMzk1ODM5OS54bWxQSwUGAAAAAAEAAQBcAAAAlwIAAAAA

View File

@@ -0,0 +1,7 @@
From: from@here.com
To: to@here.com
Subject: Nuu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi

View File

@@ -0,0 +1,7 @@
To: to@here.com
Subject: Nuu
Date: Wed, 13 Sep 2017 13:05:45 +0200
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi

Some files were not shown because too many files have changed in this diff Show More