Error while resending an email from admin page Sent Emails

Hello,

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
URL: /admin/email/resend-email
Method: POST
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 Mail.php file.

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?

Thanks!

I guess your have not correctly configured your smtp server details. so check it and try again. I have tried in and it works for me my pimcore version is (6.3.1)

Thanks for your reply!

We have tried and tested it without a sender name and in that case emails send without a sender name can successfully be resend. But when we fill out a sender name, send an email (which works perfectly) with a sender name and than try to resend it fails.

(We’re using PimCore 6.4.2)

Hello Again,
I have tested in the Pimcore(6.4.2) also it works even after i have added the Sender Name and without sender name. Try telnet to your smtp server and check in the web server that you have entered correct host address in host file of your web server.

Thanks for trying and thinking with us!

All works fine when we leave the sender name empty, so the smtp settings and dns settings must be correct.

After some debugging it seems that the format email (name) is not supported by every SMTP server. We are using the SMTP server of office365.com this server does not support this format.

The mail address parser in PimCore it self also does not support this format.
So, can we see this as a bug?