toivo blog
web and other experiments
  • joomla
    • Validating Email Domain
    • Accessing External Databases
    • Fetching User Custom Fields in Joomla 4
    • Updating articles by deleted authors
    • how to list users with custom fields
    • finding the origin of cryptic messages
    • careful with uninstall
    • adding time to logged-In users
    • How to Debug Email in Joomla
    • Troubleshooting SMTP Connection in Joomla 3.x
    • Gmail as SMTP host in Joomla 3.x
  • hiking
    • viking way part 1
    • viking way part 2

Visitors

We have 29 visitors online

  1. You are here:  
  2. Home
  3. SMTP in Joomla
  4. Troubleshooting SMTP Connection in Joomla 3.x
  5. Joomla

User Plugin to Validate Email Domain

The plugin User - Email Check has now been published in the Joomla Extensions Directory (JED). It validates the email domain, the part that comes after the @ sign, by looking it up from the Domain Name System (DNS). 

The plugin checks the email field in the user data, when it is entered into the registration form or the profile form by the frontend user or edited by the administrator through the backend of the website.

More information and links to the support forum available from https://extensions.talikka.com.

 

Details
Written by: Toivo Talikka
Category: Joomla
Published: 08 June 2025
Hits: 3878

How to Debug Email in Joomla

If clicking the button 'Send Test Email' ends up in an error message or the test email does not arrive, it is possible to debug the mail function and find out what is wrong. Follow these Joomla tutorials to get a detailed log, consisting of the SMTP connection dialogue and all the status codes. If the reason for the failure is a mystery, create a topic at the Joomla Support Forum and copy and paste the log file for the volunteer Joomla experts to study and give their advice.

How to debug SMTP mail in Joomla 3
How to debug SMTP mail in Joomla 4
How to debug SMTP mail in Joomla 5

How to debug SMTP mail in Joomla 6

Please note that Joomla 3 and Joomla 4 send the test email to the email address specified in the field 'From Email' in the Mail section of the Global Configuration,, a few lines up from the Send Test Mail button, whereas Joomla 5 and Joomla 6 send the test email to the email address of the logged-in Super User. That makes sense, because  it allows you to test different email addresses, but remember to change your email address back after the test.

Details
Written by: Toivo Talikka
Category: Joomla
Published: 08 June 2025
Hits: 173

Accessing External Databases

Would you like to create a module to display some statistics from another Joomla site, hosted in the same server? That is perfectly possible and relatively simple, by using the Joomla database connection to an external database.

A proof of concept module, Databases, can be downloaded from https://extensions.talikka.com/downloads/databases/mod_databases-1.0.0.zip

 

Details
Written by: Toivo Talikka
Category: Joomla
Published: 01 September 2024
Hits: 12997

Fetching User Custom Fields in Joomla 4

This example displays three user custom fields, fielda, fieldb and fieldc.  It uses the PHP function array_column() and therefore it does not need a foreach loop.

use Joomla\CMS\Factory;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
$customFields = FieldsHelper::getFields('com_users.user', Factory::getUser(), true);
$values = array_column($customFields, 'value', 'name');
// echo 'values = ' . print_r($values, true);
echo 'fielda = ' . $values['fielda'] . ' fieldb = ' . $values['fieldb'] . ' fieldc = ' . $values['fieldc'];

Details
Written by: Toivo Talikka
Category: Joomla
Published: 08 January 2023
Hits: 23970

Updating articles by deleted authors

You may have seen the error message "JUser: :_load: Unable to load user" and wondered if it would be possible to easily update all articles that display an error after the author or editor of the article has been deleted from the system on purpose or by accident.  The alternative, manual editing and updating each article, even though easy, can be boring and subject to mistakes, and it can take longer than expected.

If you have the numeric id of another user, who is going to replace the author or modifier of the article, the updates can be done through a SQL query.

Run the attached SQL statement first in a test environment, for example a cloned copy of  the website, hosted on your workstation, using a bundle like Wampserver from https://wampserver.aviatechno.net/.  Make a backup of the content table before the test, in case something goes wrong.

The attached SQL script replaces the author of all articles created by the deleted original user, whose name and other details cannot be found from the users table in the database.  The first SQL statement sets the user id of the new author.  After that a CREATE statement creates a temporary table  so that the article ids can be stored by the subsequent query, which finds all the articles where the author has been deleted and adds the article id to a temporary table. 

The same pattern can be used to update the column 'modified_by'. Replace 'ep28r' with your own table prefix.

SET @author = 181;
DROP TEMPORARY TABLE IF EXISTS deleted_users;
CREATE TEMPORARY TABLE deleted_users (
`id` int(10) unsigned NOT NULL, PRIMARY KEY (`id`)
)
SELECT c.id FROM ep28r_content c
LEFT JOIN ep28r_users u ON c.created_by = u.id
WHERE u.id IS NULL;
UPDATE ep28r_content c SET c.created_by = @author
WHERE c.id IN(SELECT d.id FROM deleted_users d);

Details
Written by: Toivo Talikka
Category: Joomla
Published: 12 January 2020
Hits: 42219
  1. How to list users with custom fields
  2. Finding the origin of cryptic messages
  3. Careful with Uninstall
  4. Troubleshooting SMTP connection in Joomla 3.x