-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[9.x] Add X
headers when using Mail::alwaysTo
#41101
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,6 +200,7 @@ public function testGlobalToIsRespectedOnAllMessages() | |
|
||
$sentMessage = $mailer->send('foo', ['data'], function (Message $message) { | ||
$message->from('hello@laravel.com'); | ||
$message->to('nuno@laravel.com'); | ||
$message->cc('dries@laravel.com'); | ||
$message->bcc('james@laravel.com'); | ||
}); | ||
|
@@ -209,8 +210,13 @@ public function testGlobalToIsRespectedOnAllMessages() | |
}); | ||
|
||
$this->assertSame('taylor@laravel.com', $sentMessage->getEnvelope()->getRecipients()[0]->getAddress()); | ||
$this->assertStringNotContainsString('dries@laravel.com', $sentMessage->toString()); | ||
$this->assertStringNotContainsString('james@laravel.com', $sentMessage->toString()); | ||
driesvints marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$this->assertDoesNotMatchRegularExpression('/^To: nuno@laravel.com/m', $sentMessage->toString()); | ||
$this->assertDoesNotMatchRegularExpression('/^Cc: dries@laravel.com/m', $sentMessage->toString()); | ||
$this->assertMatchesRegularExpression('/^X-To: nuno@laravel.com/m', $sentMessage->toString()); | ||
$this->assertMatchesRegularExpression('/^X-Cc: dries@laravel.com/m', $sentMessage->toString()); | ||
$this->assertMatchesRegularExpression('/^X-Bcc: james@laravel.com/m', $sentMessage->toString()); | ||
$this->assertFalse($recipients->contains('nuno@laravel.com')); | ||
$this->assertFalse($recipients->contains('dries@laravel.com')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be a bit carefully here because we're not actually checking anymore if the CC: and BCC: headers are not present anymore (something the original tests implicitly did). I don't think BCC recipients, for example, are listed in the recipients of an envelope to begin with? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm yeah ok i'll add those checks back in, with the specific headers There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BCC won't be in the string (but this is tested by checking the list of recipients) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @driesvints Specifically checking for these headers now 👍 Confirmed that the BCC address is normally returned with |
||
$this->assertFalse($recipients->contains('james@laravel.com')); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this for extra measure