We’ve been asked to resend an email to a customer from one of our websites but we get an error and the email is not send. I’ve been testing this at the development site as well and can reproduce this error. The details of this error are:
Timestamp: Wed Feb 05 2020 17:39:38 GMT+0100 (Central European Standard Time)
Status: 500 | Internal Server Error
Message: - Expected response code 250 but got code “501”, with message "501 5.1.7 Invalid address
I’ve been digging and saw that in the mail log the from address is saved with the format:
sender_email_address (sender_name). It seems that when resending an email this is used as the from address.
Looking at the code in
pimcore/pimcore/lib/Helper/Mail.php i can see that the mail
logMail() has been changed a few years back where the zend mail engine is replace by the swift email engine and at line 175:
$emailLog->setFrom(self::formatDebugReceivers($mailFrom)); the from address is set to this format which later on is saved to the email log.
Luckily we have another site that is running on an older version of PimCore and there the from addresses are saved in the format
sender_name <sender_email_address> and there the resend is working perfectly.
When we don’t use a sender name in the SMTP settings, just an sender email address, everything works fine. In this case the from addresses in the mail log are saved with just the email address. So i’m guessing that because of the changed format of the saved from addresses the resend (and also the forward) is not working.
There are multiple solutions thinkable but to me it seems the easiest to save the from addresses in the email log the way it was done before the change, thus with format
sender_name <sender_email_address>. But of course it’s also possible to change the email parser,
function parseEmailAddressField($emailString), which is also defined in the same
Note that sending an email for the first time works fine, the resend and forward from the admin page Sent Emails results in an error.
Can you please take a look at this?