Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Joomla Badge PHP Badge

Banner

Joomla Email Test CLI Tool

A command-line utility for testing email functionality in Joomla sites. This tool sends a test email using your Joomla's configured email settings, allowing administrators to verify that their email configuration is working correctly.

Features

  • Multi-version support: Compatible with Joomla 3.x, 4.x, and 5.x
  • Native integration: Uses Joomla's built-in email configuration
  • Command-line interface: Perfect for automation and server management
  • Customizable content: Set custom email subject and body
  • Zero configuration: Uses your existing Joomla email settings
  • Configuration display: Shows current email transport settings
  • SMTP connectivity test: Verifies SMTP server reachability and handshake before sending
  • Send verification: Detects Joomla 3's JException truthy-object trap and PHPMailer silent failures
  • Multiple mail methods: Supports SMTP, sendmail, PHPMailer, and all Joomla mail options

Requirements

  • PHP 7.4 or newer
  • Joomla 3.0 or newer (tested with Joomla 3.x, 4.x, and 5.x)
  • CLI environment (command line access)
  • Must be run from Joomla root directory

Installation

  1. Download the script email-test.php
  2. Upload it to the root directory of your Joomla installation

Usage

php email-test.php email-recipient [email-subject] [email-body]

Parameters

Parameter Type Description Default
email-recipient Required Email address to send the test email to -
email-subject Optional Custom email subject "Test email from Joomla"
email-body Optional Custom email body (plain text) "This is a test email from Joomla."

Examples

Basic usage:

php email-test.php user@example.org

With custom subject:

php email-test.php user@example.org "My Test Subject"

With custom subject and body:

php email-test.php user@example.org "Server Test" "Testing email functionality from production server."

Sample Output

user@server:/var/www/joomla# php email-test.php test@example.com
Detected PHP 8.2.12
Detected Joomla 5.0.3
Email recipient: test@example.com
Email subject: Test email from Joomla
Email body: This is a test email from Joomla.

Email configuration:
Mail online: Yes
Sender name: Site Admin
Sender email: admin@example.com
Mailer: Smtp
SMTP host: mail.example.com
SMTP port: 587
SMTP security: tls
SMTP authentication: Yes
SMTP username: admin@example.com

--- SMTP Connectivity Test ---
Testing connection to mail.example.com:587...
  Connection: OK (120 ms)
  Handshake: OK (EHLO/HELO accepted)
  Server: mail.example.com ESMTP Postfix
--- End SMTP Test ---

--- Sending Email ---
Email sent successfully.
SMTP server accepted the message for delivery.
Check the recipient mailbox for delivery.

Testing Email Deliverability

For comprehensive email testing, we recommend using:

  • Mail Tester - Tests spam score and deliverability
  • MailHog - Local email testing for development

Example with Mail Tester:

php email-test.php test-abc123@srv1.mail-tester.com "Production Test" "Testing from live server"

About

Script to test and verify email sending in Joomla

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages