-
Notifications
You must be signed in to change notification settings - Fork 803
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sw-26872/send-mail-message-id' into '5.7'
SW-26872 - Consider hostname config for 'Message-Id' header See merge request shopware/5/product/shopware!868
- Loading branch information
Showing
8 changed files
with
30 additions
and
33 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
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
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 |
---|---|---|
|
@@ -29,34 +29,30 @@ | |
use RuntimeException; | ||
use Shopware\Bundle\MediaBundle\MediaServiceInterface; | ||
use Shopware\Models\Mail\Log; | ||
use Shopware\Models\Order\Document\Document; | ||
|
||
class LogEntryMailBuilder implements LogEntryMailBuilderInterface | ||
{ | ||
public const INVALID_SENDER_REPLACEMENT_ADDRESS = '[email protected]'; | ||
|
||
/** | ||
* @var FilesystemInterface | ||
*/ | ||
private $filesystem; | ||
private FilesystemInterface $filesystem; | ||
|
||
/** | ||
* @var MediaServiceInterface | ||
*/ | ||
private $mediaService; | ||
private MediaServiceInterface $mediaService; | ||
|
||
private Enlight_Components_Mail $mail; | ||
|
||
public function __construct(FilesystemInterface $filesystem, MediaServiceInterface $mediaService) | ||
public function __construct(FilesystemInterface $filesystem, MediaServiceInterface $mediaService, Enlight_Components_Mail $mail) | ||
{ | ||
$this->filesystem = $filesystem; | ||
$this->mediaService = $mediaService; | ||
$this->mail = $mail; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function build(Log $entry): Enlight_Components_Mail | ||
{ | ||
$mail = new Enlight_Components_Mail('UTF-8'); | ||
$mail = clone $this->mail; | ||
|
||
try { | ||
$mail->setFrom($entry->getSender()); | ||
|
@@ -104,7 +100,6 @@ protected function assignOrderDocuments(Log $logEntry, Enlight_Components_Mail $ | |
return; | ||
} | ||
|
||
/** @var Document $document */ | ||
foreach ($logEntry->getDocuments() as $document) { | ||
$filePath = sprintf('documents/%s.pdf', $document->getHash()); | ||
$fileName = sprintf('%s.pdf', $document->getType()->getName()); | ||
|
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
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 |
---|---|---|
|
@@ -36,7 +36,7 @@ public function testMessageId(): void | |
{ | ||
$mailTransport = $this->getContainer()->get('mailtransport'); | ||
|
||
$mail = new Enlight_Components_Mail(); | ||
$mail = new Enlight_Components_Mail(null, 'test.com'); | ||
$mail->setBodyText('Test Hello'); | ||
$mail->addTo('[email protected]'); | ||
|
||
|
@@ -46,7 +46,7 @@ public function testMessageId(): void | |
static::assertArrayHasKey('Message-Id', $headers); | ||
$messageId = $headers['Message-Id'][0]; | ||
static::assertIsString($messageId); | ||
static::assertStringContainsString('@', $messageId); | ||
static::assertStringContainsString('@test.com', $messageId); | ||
static::assertStringStartsWith('<', $messageId); | ||
static::assertStringEndsWith('>', $messageId); | ||
} | ||
|