-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mailer] [Mailgun] Fix outlook sender
- Loading branch information
1 parent
df371e4
commit 5494941
Showing
4 changed files
with
16 additions
and
3 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 |
---|---|---|
|
@@ -61,6 +61,8 @@ public function testCustomHeader() | |
$deliveryTime = (new \DateTimeImmutable('2020-03-20 13:01:00'))->format(\DateTimeInterface::RFC2822); | ||
|
||
$email = new Email(); | ||
$envelope = new Envelope(new Address('[email protected]'), [new Address('[email protected]')]); | ||
$email->getHeaders()->addTextHeader('h:sender', $envelope->getSender()->toString()); | ||
$email->getHeaders()->addTextHeader('h:X-Mailgun-Variables', $json); | ||
$email->getHeaders()->addTextHeader('h:foo', 'foo-value'); | ||
$email->getHeaders()->addTextHeader('t:text', 'text-value'); | ||
|
@@ -69,7 +71,6 @@ public function testCustomHeader() | |
$email->getHeaders()->addTextHeader('template', 'template-value'); | ||
$email->getHeaders()->addTextHeader('recipient-variables', 'recipient-variables-value'); | ||
$email->getHeaders()->addTextHeader('amp-html', 'amp-html-value'); | ||
$envelope = new Envelope(new Address('[email protected]'), [new Address('[email protected]')]); | ||
|
||
$transport = new MailgunApiTransport('ACCESS_KEY', 'DOMAIN'); | ||
$method = new \ReflectionMethod(MailgunApiTransport::class, 'getPayload'); | ||
|
@@ -78,6 +79,8 @@ public function testCustomHeader() | |
$this->assertArrayHasKey('h:X-Mailgun-Variables', $payload); | ||
$this->assertEquals($json, $payload['h:X-Mailgun-Variables']); | ||
|
||
$this->assertArrayHasKey('h:sender', $payload); | ||
$this->assertEquals($envelope->getSender()->toString(), $payload['h:sender']); | ||
$this->assertArrayHasKey('h:foo', $payload); | ||
$this->assertEquals('foo-value', $payload['h:foo']); | ||
$this->assertArrayHasKey('t:text', $payload); | ||
|
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 |
---|---|---|
|
@@ -69,6 +69,8 @@ public function testSend() | |
$this->assertStringContainsString('Subject: Hello!', $content); | ||
$this->assertStringContainsString('To: Saif Eddin <[email protected]>', $content); | ||
$this->assertStringContainsString('From: Fabien <[email protected]>', $content); | ||
$this->assertStringContainsString('Sender: Senior Fabien Eddin <[email protected]>', $content); | ||
$this->assertStringContainsString('h:sender: "Senior Fabien Eddin" <[email protected]>', $content); | ||
$this->assertStringContainsString('Hello There!', $content); | ||
|
||
return new MockResponse(json_encode(['id' => 'foobar']), [ | ||
|
@@ -79,11 +81,17 @@ public function testSend() | |
$transport->setPort(8984); | ||
|
||
$mail = new Email(); | ||
$toAddress = new Address('[email protected]', 'Saif Eddin'); | ||
$fromAddress = new Address('[email protected]', 'Fabien'); | ||
$senderAddress = new Address('[email protected]', 'Senior Fabien Eddin'); | ||
$mail->subject('Hello!') | ||
->to(new Address('[email protected]', 'Saif Eddin')) | ||
->from(new Address('[email protected]', 'Fabien')) | ||
->to($toAddress) | ||
->from($fromAddress) | ||
->sender($senderAddress) | ||
->text('Hello There!'); | ||
|
||
$mail->getHeaders()->addHeader('h:sender', $mail->getSender()->toString()); | ||
|
||
$message = $transport->send($mail); | ||
|
||
$this->assertSame('foobar', $message->getMessageId()); | ||
|
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