Repository navigation
Description
π Reproduction steps
- On a self-hosted instance with a custom SMTP server for the project, trigger any auth email (password recovery, verification, magic URL, OTP, β¦).
- The mails worker (
src/Appwrite/Platform/Workers/Mails.php) pads the preview text up to 150 characters with ‌​‍‎‏repeated, and inserts it as{{previewWhitespace}}inside the hidden preview<div>inemail-base.tpl(andemail-base-styled.tpl). - For a typical preview such as "Reset your {{project}} password using the link." that comes to about 100 repeats, so about 700 invisible characters.
- Score the delivered message with rspamd (current
rspamd/rspamd:latestimage, default config).
π Expected behavior
The preview line doesn't add to the spam score, or projects can turn the padding off.
π Actual behavior
rspamd fires HIDDEN_TEXT (2.51) plus MANY_INVISIBLE_PARTS. Same message, scored locally, with only the padding changed:
| Variant | Score | HIDDEN_TEXT |
|---|---|---|
Stock email-base.tpl |
3.98 | 2.51 |
<div>{{previewWhitespace}}</div> removed (hidden preview text kept) |
1.42 | β |
The hidden preview <div> on its own isn't penalised; the zero-width run is. Together with other common rules this is enough for some providers' outbound filters to hold the mail. In our case, a German hoster (ALL-INKL) held password-reset mails for 10 minutes (X-Kas-Delay) before delivering them. With the padding line removed from the template (nothing else changed), the same reset mail passed in 3 seconds and the hoster marked it X-Spamd-Bar: /, down from +++++++.
A project can't avoid it: the preview text always comes from the locale (emails.<type>.preview), a custom template only replaces {{body}}, and the padding is added in the worker regardless of smtpBaseTemplate. The only workaround is to mount a patched email-base.tpl into the worker container.
Suggestions, any of which would help:
- drop the padding, or use a much shorter run (a few
‌ pairs is the common practice); - leave it out when a custom template message is set;
- make it configurable (env var or project setting).
π² Appwrite version
Self-hosted 2.0.0; the code is unchanged on main (checked 2026-10-04).
π» Operating system
Linux
π§± Your Environment
Docker Compose, project-level custom SMTP.
π Have you spent some time to check if this issue has been raised before?
- I checked and didn't find similar issue
π’ Have you read the Code of Conduct?
- I have read the Code of Conduct
Activity
PRINCE-TIWARI07 commentedon Oct 4, 2026
Hey! I'd love to take this one.
I had a look at the code and found the cause in Mails.php and Notifications.php. The padding repeats a group of 7 invisible characters (150 minus the preview length) times, so it ends up with roughly 7x more hidden characters than the 150-character limit was meant to allow.
What I'm thinking: keep the padding but make it match the intended length, using a short βΒ pattern in both workers. I'd keep the {{previewWhitespace}} placeholder so custom templates don't break, and add tests. If a shorter run still triggers HIDDEN_TEXT in rspamd, I'd drop the padding entirely instead.
Does that sound okay to you? Could you assign this to me? Happy to change the approach if you'd prefer something else.
J-4-K-3 commentedon Oct 4, 2026
Hi! I'd like to investigate and work on this issue
I've traced the preview padding through both Mails.php and Notifications.php and confirmed that previewWhitespace is intentionally generated and inserted into the shared email templates. I also traced it back to the commit that introduced the mechanism
I have a minimal candidate approach, but I want to validate the inbox-preview behavior and rspamd impact before proposing a final fix
I'd be happy to take this issue if it's available