I have encountered an issue where the total length of recipient email addresses was calculated and found not to exceed 2000 characters—specifically, it was set to 1970.
Before sending the email, all the email address are correct as checked.
However, during the actual sending of the email, some email addresses in the "To list" exhibiting unexpected spaces, such as "test1@outsyst ems.com", make the email cannot be sent to the recipient successfully.
What is the root cause of it? and how to solve this issue?
Thanks a lot.
Hi @Na Fu ,
Generate a clean recipients string yourself
"email1@domain.com,email2@domain.com,email3@domain.com"
Length(Email.To)
Keep the total length clearly below 2000 characters
Validate the final string before sending
Consider changing approach for mass recipients
Hope this will help you.Regards
Deepa
Instead of copying official documentation as your reply, you could have provide the url to the documentation
Thank you for your reply.
But I would like to clarify that before sending, I checked the OutSystems logs, and the email addresses are all correct, with no extra spaces.
So this is what confuses me—everything is correct for sending the email, yet the sending process ends up inserting extra spaces, which impacts the functionality.
Could you please share your implementation logic or a screenshot showing how you are building the list of email addresses?
1. Distinct
2. Loop to validate Email address, then to set in the TempToEmail
3. Check exceeding limit or not
Hi @Na Fu
I think this is happening one layer below your OML logic — at the mail transport level, not in your app.
Per RFC 5322, long header lines (like "To") get automatically "folded" — the mail library breaks the line at a certain column width and inserts a line break + space, so the header still reads as one logical line to mail clients. This is standard behavior in most SMTP libraries, including the ones under OutSystems' hood. Normally the fold lands at a comma, so you'd never notice. But if a fold happens to land inside an address instead, you get exactly what you're seeing — a stray space like "test1@outsyst ems.com".
That's also why your pre-send validation looks clean: at that point it's still just your variable, no header has been built yet. The space appears when the platform serializes the header for actual SMTP transmission — after your logic has already handed off a correct string.
A few practical