File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -524,13 +524,17 @@ protected function processStructure($structure, $partIdentifier = null)
524
524
$ mb_converted = false ;
525
525
if (function_exists ('mb_convert_encoding ' )) {
526
526
$ encodings = mb_list_encodings ();
527
- if ($ key = array_search (
528
- strtolower ($ parameters ['charset ' ]),
529
- array_map (function ($ val ){return mb_strtolower ($ val );}, $ encodings )
530
- ) !== false ) {
531
- $ parameters ['charset ' ] = $ encodings [$ key ];
532
- }else {
533
- $ parameters ['charset ' ] = ($ structure ->encoding === 0 ? 'US-ASCII ' : 'UTF-8 ' );
527
+ if (!in_array ($ parameters ['charset ' ], $ encodings )) {
528
+ $ encodingIndex = array_search ($ parameters ['charset ' ], array_map ('mb_strtolower ' , $ encodings ));
529
+ if (false !== $ encodingIndex ) {
530
+ $ parameters ['charset ' ] = $ encodings [$ encodingIndex ];
531
+ } else {
532
+ if ($ structure ->encoding === 0 ) {
533
+ $ parameters ['charset ' ] = 'US-ASCII ' ;
534
+ } else {
535
+ $ parameters ['charset ' ] = 'UTF-8 ' ;
536
+ }
537
+ }
534
538
}
535
539
536
540
$ messageBody = @mb_convert_encoding ($ messageBody , self ::$ charset , $ parameters ['charset ' ]);
You can’t perform that action at this time.
0 commit comments