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
277277 */
278278 private function sanitiseEmail (?string $ email ): ?string
279279 {
280- if (!empty ($ email )) {
280+ if (!empty ($ email ) && str_starts_with ( $ email , ' =? ' ) ) {
281281 $ decodedValue = iconv_mime_decode ($ email , ICONV_MIME_DECODE_CONTINUE_ON_ERROR , 'UTF-8 ' );
282282 $ 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 ], ' ' )) {
287284 throw new LocalizedException (__ ('Invalid email format ' ));
288285 }
289286 }
290287
291288 return $ email ;
292289 }
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- }
305290}
You can’t perform that action at this time.
0 commit comments