Skip to content

Conversation

@xmacan
Copy link
Member

@xmacan xmacan commented Oct 3, 2025

space (or other white chars) in "to" or "bcc" will cause email to be delivered only to users before first white space. Maybe it is problem only with specific email servers.

Second fix is for:
2025-10-03 09:37:13 - CMDPHP Input Validation Not Performed for 'thold_per_enabled' Backtrace: (/plugins/thold/thold.php[96]:save_thold(), /plugins/thold/thold_functions.php[5583]:get_reque
st_var(), /lib/html_utility.php[379]:html_log_input_error(), /lib/html_validate.php[44]:cacti_debug_backtrace())

Copy link
Member

@TheWitness TheWitness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the preg fix will have specific downsides if people are using full name email syntax. Better to use array map and tokenize the emails, trim the on a t a time and then join the array. Or better yet, do that at send time.

So, pushing back on this one.

@netniV
Copy link
Member

netniV commented Oct 4, 2025

Spaces are actually valid in email addresses before the prefix. Whilst we may trim the whole field we should not be adjusting any other part if it meets the RFC

@xmacan
Copy link
Member Author

xmacan commented Oct 4, 2025

Clarification of the problem:
"name a" [email protected], "name b" [email protected] -> OK
"name a" [email protected],"name b" [email protected] -> OK
[email protected], [email protected] -> OK
[email protected],[email protected] -> OK
[email protected], [email protected] -> Problem
[email protected],[email protected] -> Problem

Last two lines are valid (RFC 5322) but email is delivered only to first address. I don't know if the problem is in phpmailer, PHP, mailserver, ... Both addresses are in To: header but maybe second is missing in "envelope to".

Easy fix - add < and > when saving notification list.

@TheWitness What do you think?

@TheWitness
Copy link
Member

What is the difference between 4 & 6?

@TheWitness
Copy link
Member

Have you checked with the php mailer team? What about your mail server? What do the logs show?

@xmacan
Copy link
Member Author

xmacan commented Oct 5, 2025

What is the difference between 4 & 6?
@TheWitness sorry, better format

@xmacan
Copy link
Member Author

xmacan commented Oct 5, 2025

Have you checked with the php mailer team? What about your mail server? What do the logs show?

Yes, as I wrote - it is in To: header but it missing in envelope.

I don't want to examine this too closely. An easy solution is to add < and > to 5. Maybe for 6 too. It's not necessary, but I want to keep the same system everywhere

@xmacan
Copy link
Member Author

xmacan commented Oct 6, 2025

ok, I had few minutes for this. Problem is in our functions:
$to = parse_email_details($to);
$toText = add_email_details($to, $result, array($mail, 'addAddress'));

I will fix it

@xmacan
Copy link
Member Author

xmacan commented Oct 13, 2025

because of Cacti/cacti#6249 closing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants