SuiteCRM-Core
SuiteCRM-Core copied to clipboard
Fix #567 - Using iconv_mime_encode to fix email sending
Description
This update addresses a critical bug in the Localization.php file within the translateCharsetMIME function, which was causing an error during email sending. The issue was linked to the use of mb_encode_mimeheader, which triggered a warning due to updates in the polyfill-mbstring dependency.
PHP Warning: Undefined array key "from_addr_name" in /var/www/html/suitecrm/public/legacy/modules/Emails/EmailsController.php on line 265
PHP Warning: Undefined array key "from_addr_name" in /var/www/html/suitecrm/public/legacy/modules/Emails/EmailsController.php on line 266
PHP Warning: mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead in /var/www/html/suitecrm/vendor/symfony/polyfill-mbstring/Mbstring.php on line 152
PHP Fatal error: Uncaught TypeError: mb_encode_mimeheader(): Return value must be of type string, null returned in /var/www/html/suitecrm/vendor/symfony/polyfill-mbstring/bootstrap80.php:21
Stack trace:
#0 /var/www/html/suitecrm/public/legacy/include/Localization/Localization.php(456): mb_encode_mimeheader
Motivation and Context
There is a failing code in the legacy Localization.php in translateCharsetMIME function causing error on email sending.
How To Test This
- Set up an new suitecrm environment (tested on 8.7 and php 8.2)
- Login and go to admin page
- Configure email and try to send a test email
Types of changes
- [ x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Final checklist
- [ x] My code follows the code style of this project found here.
- [ ] My change requires a change to the documentation.
- [x ] I have read the How to Contribute guidelines.