SuiteCRM-Core icon indicating copy to clipboard operation
SuiteCRM-Core copied to clipboard

Fix #567 - Using iconv_mime_encode to fix email sending

Open blummarci24 opened this issue 1 year ago • 1 comments

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

  1. Set up an new suitecrm environment (tested on 8.7 and php 8.2)
  2. Login and go to admin page
  3. 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.

blummarci24 avatar Nov 08 '24 07:11 blummarci24

CLA assistant check
All committers have signed the CLA.

SuiteBot avatar Nov 08 '24 07:11 SuiteBot