SMTP Error Logging

General questions relating to Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Locked
User avatar
sohopros
Joomla! Intern
Joomla! Intern
Posts: 83
Joined: Fri Jul 22, 2011 1:51 pm
Contact:

SMTP Error Logging

Post by sohopros » Thu Jul 05, 2018 10:53 pm

When one of our Joomla sites' SMTP mail sender has problem authenticating, the site servers the following error:

Notice: SMTP Error! Could not authenticate.

We want to monitor these types of errors, but are not sure if Joomla logs them anywhere. They don't get logged in the error_log file on the root of the installations, we assume because these are SMTP error and not PHP errors. Can anyone provide some assistance on this?

Our basic objective is to be notified of these errors (we can have a cron job monitor a log file for changes and send us an email when a new error occurs) as indication of a contact form that is no longer working due to SMTP authentication problems.

Actually, we see this extension for RSForms! Pro that does exactly wheat we want, but we aren't using RSForms! Pro: https://extensions.joomla.org/extension ... sform-pro/

Thank you for your help
SOHO Prospecting
https://www.sohoprospecting.com - Joomla Website development
Camarillo, CA - USA
Phone 866.644.7646

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 13810
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: SMTP Error Logging

Post by toivo » Fri Jul 06, 2018 5:37 am

You can get a detailed log of all the messages exchanged between your Joomla site and the SMTP server, not just error messages.

Go to Extensions - Plugins and configure the system plugin 'System - Debug' with the following settings:
  • Allowed Groups: Registered
    Log Priorities: Error
    Log Categories: mail
    Log Almost Everything
The option 'Log Priorities' may need a bit of testing. I normally use 'All' to test SMTP connection problems, but it is possible to use a combination of values from the dropdown list, which has options like Alert and Critical.

Go to Global Configuration and turn on the debug option in the System tab - Debug Settings - Debug System.

The detailed log file is called 'everything.php' and it is in the Joomla log folder, usually administrator/logs, or, if your site was installed years ago, in the /logs folder in the main Joomla folder.
Toivo Talikka, Global Moderator

User avatar
sohopros
Joomla! Intern
Joomla! Intern
Posts: 83
Joined: Fri Jul 22, 2011 1:51 pm
Contact:

Re: SMTP Error Logging

Post by sohopros » Fri Jul 06, 2018 5:32 pm

Hi, Toivo,

Thank you for your reply. What you recommended seems to work for logging errors, but it only works while the site is in debug mode. We cannot leave a live site in debug mode indefinitely, so we are now wondering if this logging can be done with debugging turned off.
Our basic objective is to be notified of these errors (we can have a cron job monitor a log file for changes and send us an email when a new error occurs) as indication of a contact form that is no longer working due to SMTP authentication problems.
We want to be notified of these errors when a site is in production-mode (not debug) as indication of a contact form that is no longer working due to SMTP authentication problems.
SOHO Prospecting
https://www.sohoprospecting.com - Joomla Website development
Camarillo, CA - USA
Phone 866.644.7646

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 13810
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: SMTP Error Logging

Post by toivo » Fri Jul 06, 2018 5:51 pm

True, the front end email traffic cannot really be logged through the debug mode. That method is perfect for occasional testing of SMTP connection issues from the back end by Super User.

A small modification to the Joomla core would be required to log all SMTP errors into a dedicated file. Core modifications are usually not recommended because the next point release or security update may overwrite the modified code.
Toivo Talikka, Global Moderator

Linguaz
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Sun Apr 17, 2011 10:14 am

Re: SMTP Error Logging

Post by Linguaz » Fri Sep 07, 2018 1:12 pm

Thanks for your instructions, Toivo. However, after following them and experimenting with different settings, I have in no scenario been able to get a file such as everything.php generated in administrator/logs. All I get in that folder is jcontroller.log.php (I run J! 3.8.12 with PHP 7.2). In the system_debug plugin I tried different Allowed Groups, Log Priorities and Log Categories, but in the end I focussed on Log Priorities = All and left the other two fields blank. All other options are set to "Yes" or "include". The debug mode is enabled (the J! Debug Console shows at the bottom of the front and the back end).

I have configured the SMTP Host under Global Configuration>Mail Settings to point to a mailjet.com server, but I presume that would not suppress the generation of the log file?

Any pointers to what I may be doing wrong would be much appreciated.

PS: I noticed that the Debug Console is displayed even when the site is offline... Would it not make more sense to suppress it on the front end under those circumstances?


Locked

Return to “General Questions/New to Joomla! 3.x”