如果反弹监控地址为空,则发送测试邮件时出现 HTTP 500
The problem appears to be related to the following code in: app/bundles/EmailBundle/Helper/MailHelper.php Around line 1789: if ($settings = $this->isMontoringEnabled('EmailBundle', 'bounces')) { [$email, $domain] = explode('@', $settings['address']); $email .= '+bounce'; } The installation had the following configuration in config/local.php: 'EmailBundle_bounces' => array( 'address' => '', 'host' => '', 'port' => '993', 'encryption' => '/ssl', 'user' => '', 'password' => '', 'override_settings' => '0', 'folder' => '' ) Because the 'address' field was blank, this line: explode('@', $settings['address']); returns only a single array element. As a result, the domain value is undefined. Mautic then attempts to generate a bounce address similar to: +bounce_6a2919c933580329878193@ Symfony correctly rejects this as an invalid RFC 2822 email address, which causes the HTTP 500 error. Temporary workaround The original reporter tested the following modification: $settings = $this->isMontoringEnabled('EmailBundle', 'bounces'); if (!empty($settings['address']) && str_contains($settings['address'], '@')) { [$email, $domain] = explode('@', $settings['address']); } After clearing the cache and restarting PHP-FPM, email sending worked correctly. Expected behaviour Mautic should not attempt to generate a bounce address when the bounce monitoring address is blank or invalid. Before calling: explode('@', $settings['address']); Mautic should validate that: the bounce monitoring address is not empty the
内容来源: mautic/mautic