Customize cPanel system generated email notifications

nwd

Member
Feb 28, 2014
15
0
51
cPanel Access Level
Root Administrator
SUMMARY
So with 11.50 version of cPanel (or around there) came new changes to the way customizing system generated email notifications (disk warning usage/ mail warning usage) emails go out.
Old way is caput and no longer works, which I had working great.

https://documentation.cpanel.net/display/1150Docs/Notification+Templates

The new way is similar process (copy original location to new custom location so they don’t get overwritten etc. etc..) I updated both the DiskWarning.html.tmpl and the DiskWarning.subject.tmpl templates accordingly.

ISSUE
The DiskWarning.subject.tmpl is working as intended. But no matter what I try, it does not pick up the DiskWarning.html.tmpl changes. I even tried just editing one letter, nothing else. Still not working. It is not seeing that template for whatever reason.

SERVERS/VERSION BACKGROUND
Tried on two different cPanel VPS servers with cPanel build 11.50.0 (build 30) and same issue. Only the DiskWarning.subject.tmpl is being applied by cPanel.

Server Info: CENTOS 6.6 x86_64 / cPanel build 11.50.0 (build 30)

Is this a bug? Has anyone got the DiskWarning.html.tmpl changes to apply?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,219
463
Hello :)

Could you elaborate on the specific method you are using to generate the notification so we can reproduce the behavior the same way that you are?

Thank you.
 

nwd

Member
Feb 28, 2014
15
0
51
cPanel Access Level
Root Administrator
Hello :)

Could you elaborate on the specific method you are using to generate the notification so we can reproduce the behavior the same way that you are?

Thank you.
Sure, no problem. Each time you want to have it mimic a cPanel account hitting the 82% or 92% threshold (or whatever the thresholds are set to in whm > tweak etc.. ) and thus kicking off the disk warning email notification message, just need to

1) modify a test cPanel account (in WHM) disk usage to the 82% to 92% mark (so if it shows current usage is 138mb, just change to 160mb). That would mimic the account being at 86% full.

2) Then use SSH and run the /scripts/quotacheck command.

To test it again though , need to modify the Disk Quota (MB) properties on that account again, but to the next threshold disk warning limit, such as the 92%-98% mark etc..and run script via SSH again. Then continue modifying the cpanel accounts Disk Quota (MB) back in forth between each of those thresholds for it to kick off again when /scripts/quotacheck is ran.

Otherwise as you know this /scripts/quotacheck/ only runs the once a day during the cpanel update process. And just to note, when this occurs it still does not pick up the modified html file when the Disk Warning notifications are set. Only the subject file.

Let me know if you have any questions. Thanks for checking into this.
 

Attachments

AndrewH.

Well-Known Member
Dec 10, 2012
52
3
83
cPanel Access Level
Root Administrator
I was able to reproduce this and created a bug associated with this, 1555. You may want to look at your error logs and see what if any information is being dumped out there.
 
  • Like
Reactions: nwd

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,219
463
Internal case CPANEL-1555 is still open at this time. There's currently no update to provide regarding a time frame for the resolution.

Thank you.
 

nwd

Member
Feb 28, 2014
15
0
51
cPanel Access Level
Root Administrator
Sounds good. By the way I did search for any quotacheck errors (grep quotacheck /usr/local/cpanel/logs/error_log) on both my servers and found this same error.
Code:
warn [quotacheck] Error while parsing the custom âhtmlâfileâ/var/cpanel/templates/icontact_templates/Quota/DiskWarning.html.tmplâ
                                                                                                                                                                Cpanel::Notify::notification_class("class", "Quota::DiskWarning", "application", "Quota::DiskWarning", "constructor_args", ARRAY(0x1e11c38)) called at /scripts/quotacheck line 404
        main::dispatchdisk(__CPANEL_HIDDEN__, __CPANEL_HIDDEN__, 133120, 135021, 101.43, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__) called at /scripts/quotacheck line 226
[2015-10-15 16:40:11 +0400] warn [quotacheck] Error while parsing the custom âhtmlâfileâ/var/cpanel/templates/icontact_templates/Quota/DiskWarning.html.tmplâ
                                                                                                                                                                Cpanel::Notify::notification_class("class", "Quota::DiskWarning", "application", "Quota::DiskWarning", "constructor_args", ARRAY(0x1f05108)) called at /scripts/quotacheck line 377
        main::dispatchdisk_user("cpanel_user_name", "full", 133120, 135021, 101.43, "domainname.com") called at /scripts/quotacheck line 238
[2015-10-15 16:40:12 +0400] warn [quotacheck] Error while parsing the custom âhtmlâfileâ/var/cpanel/templates/icontact_templates/Quota/DiskWarning.html.tmplâ
                                                                                                                                                                Cpanel::Notify::notification_class("class", "Quota::DiskWarning", "application", "Quota::DiskWarning", "constructor_args", ARRAY(0x1e11c38)) called at /scripts/quotacheck line 404
        main::dispatchdisk(__CPANEL_HIDDEN__, __CPANEL_HIDDEN__, 133120, 135021, 101.43, __CPANEL_HIDDEN__, __CPANEL_HIDDEN__) called at /scripts/quotacheck line 226
[2015-10-15 16:40:12 +0400] warn [quotacheck] Error while parsing the custom âhtmlâfileâ/var/cpanel/templates/icontact_templates/Quota/DiskWarning.html.tmplâ
                                                                                                                                                                Cpanel::Notify::notification_class("class", "Quota::DiskWarning", "application", "Quota::DiskWarning", "constructor_args", ARRAY(0x1f05108)) called at /scripts/quotacheck line 377
        main::dispatchdisk_user("cpanel_user_name", "full", 133120, 135021, 101.43, "domainname.com") called at /scripts/quotacheck line 238
It appears the cPanel system has an issue accessing the HTML named file. (again the custom subject one works just fine) Just wondering if cPAndrewHodge is seeing the same thing in the error log when trying this and if that is what needs to be fixed.
Thanks all.
-J
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,219
463
I can confirm this is the same error message that appears in /usr/local/cpanel/logs/error_log when reproducing the issue, and is the same error message the internal case is open to address.

Thank you.
 

nwd

Member
Feb 28, 2014
15
0
51
cPanel Access Level
Root Administrator
(RESOLVED after completing several steps not listed in documentation) - Its been a while since I revisited this. After retesting, it still did not work at first. Still only the subject line custom template worked and could not get the message body (diskwarning.html.tmpl) to work, but the logs showed a different error this time. First I got this.

Code:
Cpanel::Notify::notification_class("class", "Quota::DiskWarning", "application", "Quota::DiskWarning", "constructor_args", ARRAY(0x2a9c5c0)) called at /scripts/quotacheck line 385
  main::dispatchdisk_user("wwwxxxx", "critical", 148480, 140979, 94.95, "xxxxxxxxx.com") called at /scripts/quotacheck line 246
warn [quotacheck] Error while parsing the custom “html” template: (XID jyp6pw) Template Toolkit encountered an error of type “file” while parsing the template “/var/cpanel/templates/icontact_templates/Quota/DiskWarning.html.tmpl”: include/colors.tmpl: not found
Nowhere in the Notification Templates documentation does it say you MUST also copy the include/ directory to the custom templates directory. But it appears that’s required. So after I copied that include/ directory and rerunning the test again, that resolved that error , but received a different error.

Code:
Cpanel::Notify::notification_class("class", "Quota::DiskWarning", "application", "Quota::DiskWarning", "constructor_args", ARRAY(0x2e3e4b0)) called at /scripts/quotacheck line 385
  main::dispatchdisk_user("wwwxxx", "full", 132096, 140871, 106.64, "xxxxxxxxx.com") called at /scripts/quotacheck line 246
warn [quotacheck] Error while parsing the custom “html” template: (XID vy3f8x) Template Toolkit encountered an error of type “file” while parsing the template “/var/cpanel/templates/icontact_templates/Quota/DiskWarning.html.tmpl”: wrapper/main.html.tmpl: not found
[2016-04-30 08:06:55 -0500] info [quotacheck] Quota::DiskWarning Notification => [email protected]***** via EMAIL [eventimportance => High (1)]
Low and behold, now it looks like it needs the wrapper/ directory placed in the customization templates directory. Again, nowhere in the Notification Templates documentation does it say you MUST also copy the wrapper/ directory to the custom templates directory for the modifications to work.

After copying the wrapper/ directory, I was able to rerun the test successfully with no errors and it successfully sent the customized template.

So to recap, if you’re going to use custom notifications (highly recommend for your automation process), you must also copy the wrapper/ and include/ folders to the custom templates directory as well. Or it won’t work. Hope this helps cPanel and any other users that want to use the custom templates directory, specifically the quota/ templates.
 
Last edited:

nwd

Member
Feb 28, 2014
15
0
51
cPanel Access Level
Root Administrator
For what its worth, I attached my custom created auto notifications end results, that are way more user friendly, that get (automatically) sent to clients that are getting close to mailbox size quota or hosting disk space quota. They include helpful information and links to knowledgebase articles and other next steps information. Let me know what you think. Thanks!
 

Attachments

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,219
463
Hello,

Thank you for bring this to our attention. I've opened a case with our documentation team to ensure the document is updated with instructions regarding the wrapper and include directories. I'll update this thread once the updated document is published.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,219
463
Any idea when the documentation will be updated?
It's still under review at this time, but the updated instructions referenced on this thread should work. I'll update this thread as soon as the changes are published.

Thank you.
 

jacobkball

Registered
Aug 27, 2007
3
0
51
Can I make a suggestion regarding the documentation for this feature? I see that you've added steps 5 and 6 to the example, however it's not in the actual Customize a template instructions above. Perhaps that could be re-written as such:

To customize a template, follow these steps:
  1. Copy the /usr/local/cpanel/etc/icontact_templates/include/ directory to the /var/cpanel/templates/icontact_templates custom templates directory.
  2. Copy the /usr/local/cpanel/etc/icontact_templates/wrapper/ directory to the /var/cpanel/templates/icontact_templates custom templates directory.
  3. Copy the desired template from the /usr/local/cpanel/etc/icontact_templates/ directory to the /var/cpanel/templates/icontact_templates/ custom templates directory, and make your changes to the copy.
I know it's repeated further below in the example instructions, but I somehow missed it, and then found that in this thread :)
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,219
463
Can I make a suggestion regarding the documentation for this feature? I see that you've added steps 5 and 6 to the example, however it's not in the actual Customize a template instructions above.
I've opened a case with our Documentation Team (# DOC-9805) to request this change. I'll update this thread with the outcome once available.

Thank you.

Update: The case is now complete. We've made some changes to help clarify the requirement to copy those directories if it's the first time customizing a template.
 
Last edited:

middlegrey

Registered
Apr 9, 2018
3
0
1
Berlin
cPanel Access Level
Root Administrator
I've followed the updated documentation but am receiving the following log message using WHM v68.0.36 on CENTOS 6.9

Code:
[2018-04-07 07:53:37 +1000] warn [queueprocd] Error while parsing the custom “html” template: (XID jccey7) [asis,Template Toolkit] encountered an error of type “file” while parsing the template “/var/cpanel/templates/icontact_templates/Quota/DiskWarning.html.tmpl”: cache failed to write DiskWarning.html.tmpl: File::Path does not define $File::Path::VERSION--version check failed at /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/5.24.1/File/Temp.pm line 14.

Any thoughts?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,219
463
Hello @middlegrey,

Can you verify step-by-step the specific commands you ran, and the exact changes you made to the template file?

Thank you.
 

middlegrey

Registered
Apr 9, 2018
3
0
1
Berlin
cPanel Access Level
Root Administrator
Hello @middlegrey,

Can you verify step-by-step the specific commands you ran, and the exact changes you made to the template file?

Thank you.

1) Copy include and wrapper directories from /usr/local/cpanel/etc/icontact_templates/ to /var/cpanel/templates/icontact_templates

2) Copy DiskWarning.subject.tmpl from /usr/local/cpanel/etc/icontact_templates/Quota to /var/cpanel/templates/icontact_templates/Quota (even without changes the error occurs)

3) Update account quota via WHM to trigger disk usage warning and run /scripts/quotacheck
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,219
463
Hello @middlegrey,

I was unable to reproduce that error message when taking the steps referenced in your last response. Could you open a support ticket using the link in my signature so we can take a closer look?

Thank you.