Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain characters in recipient address can cause email to fail #2339

Closed
ghost opened this issue Jan 23, 2019 · 14 comments
Closed

Certain characters in recipient address can cause email to fail #2339

ghost opened this issue Jan 23, 2019 · 14 comments
Labels
resolved A fixed issue
Milestone

Comments

@ghost
Copy link

ghost commented Jan 23, 2019

Cacti is failing to send email (for reports, issues, etc) when there is a plus sign in the recipient email address, in my case, ubuntusv+orion@mydomain.com. If that's the only recipient defined, mail will not be sent out. If there are more than one recipients defined, mail is sent out but only to recipients without the plus sign in the email address.

Email addresses in settings_test_email in the settings table and email in the reports table are both saved with plus sign.

I can replicate this issue every time.

@cigamit
Copy link
Member

cigamit commented Jan 26, 2019

Please provide details from your mail server relative to the failure issues.

@cigamit
Copy link
Member

cigamit commented Jan 26, 2019

Never mind. Loving regex borrowed.

@cigamit
Copy link
Member

cigamit commented Jan 26, 2019

Resolved.

cigamit added a commit that referenced this issue Jan 26, 2019
MAILER WARNING: Mail failed from ... Message: You must provide at least
one recipient email address.
@cigamit cigamit added the resolved A fixed issue label Jan 26, 2019
@gdsotirov
Copy link
Contributor

gdsotirov commented Jan 27, 2019

I have the same problem with a mail address containing dash (-) in domain name.

gdsotirov added a commit to gdsotirov/cacti that referenced this issue Jan 27, 2019
Additional fix for issue Cacti#2339
cigamit pushed a commit that referenced this issue Jan 27, 2019
@cigamit
Copy link
Member

cigamit commented Jan 27, 2019

Better now?

@gdsotirov
Copy link
Contributor

gdsotirov commented Jan 27, 2019

Yes. Already tested it on my installation (I mean even before the PR).

@cigamit
Copy link
Member

cigamit commented Jan 27, 2019

hehe, yup. All good on this side too. Thanks for the help.

@DoubleBeast
Copy link

I have a similar issue with the "Notify Primary Admin of Issues" funtion, the log show this:

09-02-2019 09:25:41 - MAILER WARNING: Mail failed from '"Cacti" probando@gmail.com', to '', cc '', Subject 'Cacti System Warning', Message: You must provide at least one recipient email address.

The selected user in authentication page has a valid email address and the test/thold emails works fine.

I'm using stable 1.2.1, is this issue solved in development branch?

@cigamit
Copy link
Member

cigamit commented Feb 9, 2019

It is, though that format does not seem quite right. Update lib/functions.php and test away though. If this is a new install, you might just want to clone as there are several other changes that may introduce bugs if you do not pull the remainder of the files. Not too many file though.

@netniV
Copy link
Member

netniV commented Feb 24, 2019

No feedback, closed.

@netniV netniV closed this as completed Feb 24, 2019
@netniV netniV changed the title MAILER WARNING: Mail failed from ... Message: You must provide at least one recipient email address. Certain characters in recipient address can cause email to fail Feb 24, 2019
@justmace
Copy link

2019/03/14 16:58:00 - MAILER WARNING: Mail failed via PHP Mail() Function from 'Cacti <something@gmail.com>', to '', cc '', Subject 'Cacti Test Message', Error: You must provide at least one recipient email address.
2019/03/14 16:58:00 - CMDPHP PHP ERROR WARNING Backtrace: (/settings.php[254]:email_test(), /lib/functions.php[3837]:send_mail(), /lib/functions.php[3263]:mailer(), /lib/functions.php[3418]:parse_email_details(), /lib/functions.php[3637]:split_emaildetail(), /lib/functions.php[3683]:preg_match(), CactiErrorHandler())
2019/03/14 16:58:00 - ERROR PHP WARNING: preg_match(): Compilation failed: invalid range in character class at offset 29 in file: /usr/share/cacti/lib/functions.php on line: 3683
2019/03/14 16:58:00 - CMDPHP PHP ERROR WARNING Backtrace: (/settings.php[254]:email_test(), /lib/functions.php[3837]:send_mail(), /lib/functions.php[3263]:mailer(), /lib/functions.php[3386]:parse_email_details(), /lib/functions.php[3637]:split_emaildetail(), /lib/functions.php[3683]:preg_match(), CactiErrorHandler())
2019/03/14 16:58:00 - ERROR PHP WARNING: preg_match(): Compilation failed: invalid range in character class at offset 29 in file: /usr/share/cacti/lib/functions.php on line: 3683
2019/03/14 16:58:00 - CMDPHP PHP ERROR WARNING Backtrace: (/settings.php[254]:email_test(), /lib/functions.php[3837]:send_mail(), /lib/functions.php[3263]:mailer(), /lib/functions.php[3386]:parse_email_details(), /lib/functions.php[3637]:split_emaildetail(), /lib/functions.php[3683]:preg_match(), CactiErrorHandler())
2019/03/14 16:58:00 - ERROR PHP WARNING: preg_match(): Compilation failed: invalid range in character class at offset 29 in file: /usr/share/cacti/lib/functions.php on line: 3683 

Sorry if I wasn't supposed to reply here, I can open another issue, but it's a continuation of this one.

I'm using cacti 1.2.2.
With PHP 7.1 and 7.2, the test email works perfectly, but as soon as I upgraded it to PHP 7.3 it stopped working ( log section above )
Tried clean installs with PHP 7.1, 7.2 and 7.3, it only failed with PHP 7.3.
( btw, tried all mail services, the results are the same)

@netniV
Copy link
Member

netniV commented Mar 14, 2019

I will have to get PHP 7.3 installed and test it out.

@netniV
Copy link
Member

netniV commented Mar 14, 2019

Btw, can you also open this as a new issue since it isn't the same problem?

@justmace
Copy link

sure, issue #2523 . thanks!

@netniV netniV added this to the v1.2.3 milestone Mar 28, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Jun 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

5 participants