cPanel & WHM Version 114 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Notification Email Preview Script

Ben T shared this idea 7 years ago
Open Discussion

At the moment, it is incredibly difficult to test individual notification templates sent by cPanel. The only way to test the notification is to make a modification to a user account already active in the system, and hope that cPanel sends out the email for that particular notification correctly.

Testing modifications to the "bandwidth exceeded" template, for example, requires an administrator to change an account so that it is close to (or exceeding) its bandwidth limit and then simply wait until cPanel notices the bandwidth usage and sends out its notification to the user. If the template is faulty, then more than likely, the email notification doesn't get sent at all, and the developer has to go crawling through the logs to find out what happened.

In lieu of a full-blown notification template design tool in WHM/cPanel, this feature request proposes a script that could be run from the command line to test an individual template, using the list of templates in the Notification Templates section of the documentation.

Perhaps, something along the lines of:

  1. /scripts/testnotification --template=BandwidthUsageExceeded/User.html.tmpl

The script could perhaps pre-fill all the email variables with demonstration values to make it even easier.

If any errors were encountered with the template or delivery of the email, they could be displayed to the user at run-time, allowing a developer to quickly ascertain any problems with the notification system.

Replies (1)


We actually have an internal tool that we use for this. It would require some work to finesse it and publish it for public consumption. The end result looks something like this:

➜   ./test_icontact_notifications --help
How to use: 
    --type       Notification Type (Example: --type=Backup::Success )
    --all        Send All Notification types (Example: --all )
    --deferred   Queue the notification instead of sending it
And it utilizes the current server settings for notification types and priorities so we can test those configurations.

How useful would that be in its current state?

Dustin Scherer (he/him) | Product Owner | @dustinscherer

Leave a Comment
Attach a file