File tree Expand file tree Collapse file tree 2 files changed +17
-12
lines changed
Filter options
src/Symfony/Component/Mailer/Bridge/Amazon Expand file tree Collapse file tree 2 files changed +17
-12
lines changed
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ public function testSend()
82
82
$ this ->assertSame ('Hello! ' , $ content ['Content ' ]['Simple ' ]['Subject ' ]['Data ' ]);
83
83
$ this ->assertSame ('"Saif Eddin" <saif.gmati@symfony.com> ' , $ content ['Destination ' ]['ToAddresses ' ][0 ]);
84
84
$ this ->assertSame ('=?UTF-8?B?SsOpcsOpbXk=?= <jeremy@derusse.com> ' , $ content ['Destination ' ]['CcAddresses ' ][0 ]);
85
- $ this ->assertSame ('"Fabien" <fabpot@symfony.com> ' , $ content ['FromEmailAddress ' ]);
85
+ $ this ->assertSame ('=?UTF-8?B?RmFiacOpbg==?= <fabpot@symfony.com> ' , $ content ['FromEmailAddress ' ]);
86
86
$ this ->assertSame ('Hello There! ' , $ content ['Content ' ]['Simple ' ]['Body ' ]['Text ' ]['Data ' ]);
87
87
$ this ->assertSame ('<b>Hello There!</b> ' , $ content ['Content ' ]['Simple ' ]['Body ' ]['Html ' ]['Data ' ]);
88
88
$ this ->assertSame (['replyto-1@example.com ' , 'replyto-2@example.com ' ], $ content ['ReplyToAddresses ' ]);
@@ -103,7 +103,7 @@ public function testSend()
103
103
$ mail ->subject ('Hello! ' )
104
104
->to (new Address ('saif.gmati@symfony.com ' , 'Saif Eddin ' ))
105
105
->cc (new Address ('jeremy@derusse.com ' , 'Jérémy ' ))
106
- ->from (new Address ('fabpot@symfony.com ' , 'Fabien ' ))
106
+ ->from (new Address ('fabpot@symfony.com ' , 'Fabién ' ))
107
107
->text ('Hello There! ' )
108
108
->html ('<b>Hello There!</b> ' )
109
109
->replyTo (new Address ('replyto-1@example.com ' ), new Address ('replyto-2@example.com ' ))
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ protected function getRequest(SentMessage $message): SendEmailRequest
53
53
$ envelope = $ message ->getEnvelope ();
54
54
55
55
$ request = [
56
- 'FromEmailAddress ' => $ envelope -> getSender ()-> toString ( ),
56
+ 'FromEmailAddress ' => $ this -> stringifyAddress ( $ envelope -> getSender () ),
57
57
'Destination ' => [
58
58
'ToAddresses ' => $ this ->stringifyAddresses ($ this ->getRecipients ($ email , $ envelope )),
59
59
],
@@ -114,15 +114,20 @@ private function getRecipients(Email $email, Envelope $envelope): array
114
114
protected function stringifyAddresses (array $ addresses ): array
115
115
{
116
116
return array_map (function (Address $ a ) {
117
- // AWS does not support UTF-8 address
118
- if (preg_match ('~[\x00-\x08\x10-\x19\x7F-\xFF\r\n]~ ' , $ name = $ a ->getName ())) {
119
- return sprintf ('=?UTF-8?B?%s?= <%s> ' ,
120
- base64_encode ($ name ),
121
- $ a ->getEncodedAddress ()
122
- );
123
- }
124
-
125
- return $ a ->toString ();
117
+ return $ this ->stringifyAddress ($ a );
126
118
}, $ addresses );
127
119
}
120
+
121
+ protected function stringifyAddress (Address $ a ): string
122
+ {
123
+ // AWS does not support UTF-8 address
124
+ if (preg_match ('~[\x00-\x08\x10-\x19\x7F-\xFF\r\n]~ ' , $ name = $ a ->getName ())) {
125
+ return sprintf ('=?UTF-8?B?%s?= <%s> ' ,
126
+ base64_encode ($ name ),
127
+ $ a ->getEncodedAddress ()
128
+ );
129
+ }
130
+
131
+ return $ a ->toString ();
132
+ }
128
133
}
You can’t perform that action at this time.
0 commit comments