-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
vendor | ||
composer.lock | ||
.idea | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From: Arunas Practice <[email protected]> | ||
To: Arunas arukomp <[email protected]> | ||
Reply-To: Arunas Practice <[email protected]> | ||
Subject: Appointment confirmation | ||
Message-ID: <[email protected]> | ||
MIME-Version: 1.0 | ||
Date: Thu, 24 Aug 2023 14:51:14 +0100 | ||
Content-Type: multipart/alternative; boundary=s1NCDW_3 | ||
|
||
--s1NCDW_3 | ||
Content-Type: text/plain; charset=utf-8 | ||
Content-Transfer-Encoding: quoted-printable | ||
Hi Arunas Skirius, | ||
This is a confirmation of your appointment. | ||
--s1NCDW_3 | ||
Content-Type: text/html; charset=utf-8 | ||
Content-Transfer-Encoding: quoted-printable | ||
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<title>Title</title> | ||
</head> | ||
</html> | ||
--s1NCDW_3-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,36 @@ | |
]); | ||
}); | ||
|
||
it('can parse a multi-format mail message', function () { | ||
$message = Message::fromFile(__DIR__ . '/../Fixtures/multiformat_email.eml'); | ||
|
||
expect($message->getFrom())->toBe('Arunas Practice <[email protected]>') | ||
->and($message->getTo())->toBe('Arunas arukomp <[email protected]>') | ||
->and($message->getReplyTo())->toBe('Arunas Practice <[email protected]>') | ||
->and($message->getSubject())->toBe('Appointment confirmation') | ||
->and($message->getId())->toBe('[email protected]') | ||
->and($message->getDate()->format('Y-m-d H:i:s'))->toBe('2023-08-24 14:51:14') | ||
->and($message->getBoundary())->toBe('s1NCDW_3'); | ||
|
||
$parts = $message->getParts(); | ||
|
||
expect($parts)->toHaveCount(2) | ||
->and($parts[0]->getContentType())->toBe('text/plain; charset=utf-8') | ||
->and($parts[0]->getHeaders())->toBe([ | ||
'Content-Type' => 'text/plain; charset=utf-8', | ||
'Content-Transfer-Encoding' => 'quoted-printable', | ||
]) | ||
->and($parts[1]->getContentType())->toBe('text/html; charset=utf-8') | ||
->and($parts[1]->getHeaders())->toBe([ | ||
'Content-Type' => 'text/html; charset=utf-8', | ||
'Content-Transfer-Encoding' => 'quoted-printable', | ||
])->and($message->getTextPart()?->getContent())->toBe(<<<EOF | ||
Hi Arunas Skirius, | ||
This is a confirmation of your appointment. | ||
EOF); | ||
|
||
}); | ||
|
||
it('can get contents of an encoded part', function () { | ||
$messageString = <<<EOF | ||
From: [email protected] | ||
|