Email addresses ending in whitespaces wreaking havoc

Hello,

I have an issue that drives me bonkers…
One of my clients keeps importing emails that have whitespaces at the end – either a regular whitespace or the \x{A0} whitespace

Somehow, it passes the test at the time of import, but then, it invariably blocks the send in an endless loop…

There is simply nothing i can do to prevent this client from doing this…
My usual trick is to blacklist the erroneous email (usually, the same email without the usual characters is already in the db because i cleaned it the last time), but i can’t keep checking the system every day…

Is there anything that can be done to catch these addresses to begin with?

maybe the rtrim function in php could be applied just before import?

Thank you so much!!

@petersphilo Yes we have also had trouble with whitespace sometimes. It should be straightforward to patch the address validation process in your copy of phpList to trim the whitespace or use other functions to detect and remove it. Please share your changes here or in a GitHub PR so that others can benefit from your experience.