File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed
lib/internal/Magento/Framework/Mail Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -277,29 +277,14 @@ private function convertAddressArrayToAddressList(array $arrayList): AddressList
277
277
*/
278
278
private function sanitiseEmail (?string $ email ): ?string
279
279
{
280
- if (!empty ($ email )) {
280
+ if (!empty ($ email ) && str_starts_with ( $ email , ' =? ' ) ) {
281
281
$ decodedValue = iconv_mime_decode ($ email , ICONV_MIME_DECODE_CONTINUE_ON_ERROR , 'UTF-8 ' );
282
282
$ localPart = explode ('@ ' , $ decodedValue );
283
- if (!empty ($ localPart [0 ]) && str_starts_with ($ email , '=? ' ) && str_contains ($ localPart [0 ], ' ' )) {
284
- throw new LocalizedException (__ ('Invalid email format ' ));
285
- }
286
- if ($ this ->validateSpecialCharacters ($ email )) {
283
+ if (!empty ($ localPart [0 ]) && str_contains ($ localPart [0 ], ' ' )) {
287
284
throw new LocalizedException (__ ('Invalid email format ' ));
288
285
}
289
286
}
290
287
291
288
return $ email ;
292
289
}
293
-
294
- /**
295
- * Check email contains invalid characters
296
- *
297
- * @param string $email
298
- * @return int
299
- */
300
- private function validateSpecialCharacters (string $ email ): int
301
- {
302
- $ localPart = explode ('@ ' , $ email );
303
- return !empty ($ localPart [0 ]) ? preg_match ('/^.*[#!&%~$+ ]+.*$/ ' , $ localPart [0 ]) : 0 ;
304
- }
305
290
}
You can’t perform that action at this time.
0 commit comments