Skip to content

[5.4] Improve error logging in Mail API#48045

Open
alikon wants to merge 2 commits into
joomla:5.4-devfrom
alikon:patch-2
Open

[5.4] Improve error logging in Mail API#48045
alikon wants to merge 2 commits into
joomla:5.4-devfrom
alikon:patch-2

Conversation

@alikon

@alikon alikon commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Enhance error handling in Mail API by differentiating between error and debug messages.

Pull Request resolves #45963 .

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

change LOG priority based if is an error or not

Testing Instructions

  • Enable 'Log Almost Everything' and 'Debug System'
  • Home Dashboard > Server > Send Test Mail
  • Check administrator/logs/everything.php

Actual result BEFORE applying this Pull Request

All log entries for sending e-mails have the priority ERROR

Expected result AFTER applying this Pull Request

if no errors logs priority DEBUG

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

Enhance error handling in Mail API by differentiating between error and debug messages.
@exlemor

exlemor commented Jul 3, 2026

Copy link
Copy Markdown

I have not tested this item.

I have successfully tested this during Friday PR Testing Session July 3rd, 2026.

Thanks @alikon


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48045.

@CSGoat0

CSGoat0 commented Jul 3, 2026

Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on a3e4c0d


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48045.

@exlemor

exlemor commented Jul 3, 2026

Copy link
Copy Markdown

I have tested this item ✅ successfully on a3e4c0d

I have tested this successfully during Friday's PR Testing Session July 3rd.

Thanks @alikon


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48045.

@QuyTon

QuyTon commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48045.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jul 3, 2026
// Configure a callback function to handle errors when $this->debug() is called
$this->Debugoutput = function ($message, $level) {
Log::add(\sprintf('Error in Mail API: %s', $message), Log::ERROR, 'mail');
if (strpos(strtolower($message), 'fail') !== false || strpos(strtolower($message), 'error') !== false) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not reliable solution. There are many different kind of error messages, and from what I see, some of the error messages can also be translated, so you cannot check for fail or error to determine of it is an error or a debug message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

as i wrote this is an improvement, and it will catch most of the typical "error" messages, can you suggest other kind of "error" messages ?
as for the translated error messages, even if they are, they will be in low percentage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Look at how Debugoutput is used in PHPMailer, I don't see a reliable way to handle it. I would leave the issue as won't fix instead of this unreliable solution

@muhme muhme removed the RTC This Pull Request is Ready To Commit label Jul 4, 2026
@muhme

muhme commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Returned to “Pending” status due to concerns


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48045.

@muhme muhme added the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug PR-5.4-dev Updates Requested Indicates that this pull request needs an update from the author and should not be tested.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[5.3] Email log entries are ERRORs even though the email was send successfully

8 participants