Your software
My Mautic version is: v5.0.0
My PHP version is: 8.1.18
My Database type and version is: 10.6.15-MariaDB-cll-lve
Your problem
/emails//contact//send throws a 500 error
These errors are showing in the log:
mautic.CRITICAL: Uncaught PHP Exception TypeError: "Symfony\Component\Mime\Address::__construct(): Argument #1 ($address) must be of type string, null given, called in /home/root/domains/domain.com/public_html/app/bundles/EmailBundle/Helper/MailHelper.php on line 929" at /home/root/domains/domain.com/public_html/vendor/symfony/mime/Address.php line 42 {"exception":"[object] (TypeError(code: 0): Symfony\\Component\\Mime\\Address::__construct(): Argument #1 ($address) must be of type string, null given, called in /home/root/domains/domain.com/public_html/app/bundles/EmailBundle/Helper/MailHelper.php on line 929 at /home/root/domains/domain.com/public_html/vendor/symfony/mime/Address.php:42)"} {"hostname":"domain.com","pid":2834374}
Steps I have tried to fix the problem:
I added two extra lines in my MailHelper.php file
public function addTo($address, $name = null)
{
$this->checkBatchMaxRecipients();
try {
$this->logError('Debugging.....'); //TEST CODE
$this->logError($address); //TEST CODE
$this->logError($name); //TEST CODE
$name = $this->cleanName($name);
$this->message->addTo(new Address($address, $name ?? ''));
$this->queuedRecipients[$address] = $name;
return true;
} catch (\Exception $e) {
$this->logError($e, 'to');
return false;
}
}
And my log looks like this
[2024-01-11 03:46:33] mautic.ERROR: [MAIL ERROR] Debugging..... [] {"hostname":"domain.com","pid":2834374}
[2024-01-11 03:46:33] mautic.ERROR: [MAIL ERROR] [] {"hostname":"domain.com","pid":2834374}
[2024-01-11 03:46:33] mautic.ERROR: [MAIL ERROR] [] {"hostname":"domain.com","pid":2834374}
[2024-01-11 03:46:33] mautic.CRITICAL: Uncaught PHP Exception TypeError: "Symfony\Component\Mime\Address::__construct(): Argument #1 ($address) must be of type string, null given, called in /home/root/domains/domain.com/public_html/app/bundles/EmailBundle/Helper/MailHelper.php on line 929" at /home/root/domains/domain.com/public_html/vendor/symfony/mime/Address.php line 42 {"exception":"[object] (TypeError(code: 0): Symfony\\Component\\Mime\\Address::__construct(): Argument #1 ($address) must be of type string, null given, called in /home/root/domains/domain.com/public_html/app/bundles/EmailBundle/Helper/MailHelper.php on line 929 at /home/root/domains/domain.com/public_html/vendor/symfony/mime/Address.php:42)"} {"hostname":"domain.com","pid":2834374}
Not sure why this is blank and where is this function being called from.