• The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

Forwarded to devs Plesk password reset email for an email account bounced by IONOS

Alex Presland

Basic Pleskian
Username:

TITLE

Plesk password reset email for an email account bounced by IONOS

PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE

Plesk Obsidian v18.0.81_build1800261111.12 os_Ubuntu 22.04. CPU = AMD EPYC 7571 (AWS)

PROBLEM DESCRIPTION

A user's password reset emails weren't getting through. I investigated and found an error message in /var/log/maillog:

status=bounced (host mx00.ionos.co.uk[212.227.15.171] said: 554-Transaction failed 554-Reject due to policy restrictions. 554 For explanation visit 554 Transaction failed Reject due to policy restrictions

STEPS TO REPRODUCE

Have a user whose external email address is hosted on IONOS. Trigger a password reset on their account.

ACTUAL RESULT

User doesn't get the password reset email because it is summarily rejected by IONOS, citing that it is not formatted correctly.

EXPECTED RESULT

Email is successfully delivered to the user, so that they can reset their email account password

ANY ADDITIONAL INFORMATION

None at present.

YOUR EXPECTATIONS FROM PLESK SERVICE TEAM

Confirm bug
 
I've sent myself a test email and looked at the headers... my findings are:
  1. The To: line in the headers is split across two rows, as it is 81 characters long. The actual email address it was going to is shorter, so that is unlikely to affect this.
  2. The email address in the To: field is being sent as UTF-8, as the redacted version below shows:

I've also taken the text and put it into a hex viewer, and confirmed that it only contains ASCII characters.
 
Hi Alex,

I think I can explain why IONOS rejects the message.

Your header is:
To: [email protected]?= <[email protected]>

Plesk puts the mailbox address into the display-name part of the header and wraps it in an RFC 2047 encoded-word, even though it is pure ASCII. According to RFC 2047, section 5 (3), an encoded-word used inside a "phrase" (which is what a display name is) may only contain letters, digits and the characters ! * + - / = _ when using Q-encoding. The characters "@" and "." are not allowed there and would have to be encoded as =40 and =2E.

Plesk leaves "@" and "." unencoded inside the encoded-word. That makes the To header syntactically invalid, which matches the IONOS message "The header field To is syntactically not correct" (RFC 5322 / RFC 2047). Other providers are more tolerant, IONOS apparently is not.

A valid header would be, for example:
To: "[email protected]" <[email protected]>
(or the display name correctly encoded, or simply omitted).

This is my conclusion from the header you posted, I have not checked it against the Plesk source code.

@Sebahat.hadzhi could you please confirm this and fix the generation of the To header for password reset emails (no encoded-word for plain ASCII display names, or correct Q-encoding of "@" and "."), as it prevents delivery to strict providers like IONOS?

Workaround until then: set the new mailbox password manually in the panel for affected users.

Regards
Tessa
 
Update: I checked the Plesk code on my server. In /opt/psa/admin/plib/vendor/plesk/laminas-mail/src/Header/AbstractAddressList.php, getFieldValue(), the display name is always passed to HeaderWrap::mimeEncodeValue() when the format is FORMAT_ENCODED and the header encoding is not ASCII, even if the name is pure ASCII (here: the mailbox address itself).

That ends up in Mime::encodeQuotedPrintableHeader() (laminas-mime, Mime.php), which after the quoted-printable step only additionally encodes "?", ",", " " and "_". As Alex' header shows, "@" and "." stay unencoded inside the =?UTF-8?Q?...?= word, which violates RFC 2047 section 5 (3) and is rejected by strict receivers like IONOS.

A second issue in the same method: a display name is only put in double quotes if it contains "," or ";". "@" and "." are RFC 5322 specials and would also require a quoted-string.

@Sebahat.hadzhi, could you please confirm this? Suggested fix: only MIME-encode display names that actually contain non-ASCII characters, and output pure ASCII names as a quoted-string (escaping " and \) if they contain specials. Encoded-words used as display names would additionally have to encode all characters outside [A-Za-z0-9!*+-/].

This bug has most likely existed for a long time. The same symptom was already reported in 2022: Plesk system mails (password reset) rejected by IONOS with 554, and the Plesk log shows a broken encoded-word in the To header: to=<=?UTF-8?Q?Andrea=?= <...>

A similar malformed encoded-word (encoding stops in the middle of the address, with "@sourcetronic.com" left outside) was also shown in the mail queue in this thread:

So it is likely that the header generation has been faulty for years and only strict receivers like IONOS notice it.

Regards
Tessa
 
Last edited:
Thanks for all your insights, Tessa. I opened an internal report for our team to further review the behavior. I will follow up with more details shortly.
 
The behavior was recognized as a bug identified with ID PPPM-15634. I cannot provide an ETA for the fix yet. In the meantime, the workaround suggested by our engineers is to rewrite the header in outgoing SMTP with Postfix smtp_header_checks as described below:

Code:
/etc/postfix/smtp_header_checks_to_fix
/^To:[[:space:]]+=\?[Uu][Tt][Ff]-8\?[Qq]\?[^?]*[@.][^?]*\?=[[:space:]]+(<[^>]+>)[[:space:]]*$/ REPLACE To: ${1}
postconf -e "smtp_header_checks = regexp:/etc/postfix/smtp_header_checks_to_fix" && postfix reload

When tested the header is rewritten to To: <[email protected]> and the email is delivered.

Note: the rewrite happens after Plesk's DKIM signing, so if the sender domain DKIM-signs this email, the signature breaks.
 
Hi @Sebahat.hadzhi, thanks for the quick confirmation and the workaround.

One question about it: the rewrite happens after dk_sign has signed the message, and the To header is part of the signed headers (h=To:From:Subject), so the DKIM signature of every rewritten password reset mail will fail. Do you or the engineers know how IONOS (mx00.ionos.co.uk) treats incoming mail with a broken DKIM signature? For example whether it ends up in spam, gets rejected via the sender's DMARC policy, or is simply accepted. I could not find a statement on this on the IONOS postmaster pages.

Also, can you confirm that the workaround was tested against IONOS with DKIM enabled for the sender domain, and not only checked for the header rewrite?

As an alternative, I patched AbstractAddressList.php locally so that the To header is generated correctly before signing, which keeps the DKIM signature valid, and it works for me. Maybe that helps with the fix for PPPM-15634: only MIME-encode display names that contain non-ASCII characters, output pure ASCII names as a quoted-string if they contain specials, and encode all characters outside [A-Za-z0-9!*+-/] in Q-encoded display names.

Could the engineers please also tell us whether this patch can be used as a supported alternative to the Postfix workaround until the fix is released? The next Plesk update would overwrite the file with your fixed version anyway. Of course the original file has to be backed up before applying the patch, so that it can be restored at any time.

Regards
Tessa
 
Back
Top