Customize cPanel system generated email notifications
-
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. 0 -
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.0 -
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. 0 -
I was hoping this would be fixed in yesterdays or todays cPanel updates. But I don't see it listed. Hopefully soon as I got spoiled with the previous custom email/automated notification method working. Thanks for submitting the bug and checking on it. 11.52 Change Log - Documentation - cPanel Documentation 0 -
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. 0 -
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. 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. -J0 -
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. 0 -
(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. 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.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 => info@xxxxxxxxxx***** 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.0 -
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! 0 -
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. 0 -
Any idea when the documentation will be updated? 0 -
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.0 -
Hello, The following document now includes the updated instructions: Notification Templates - Documentation - cPanel Documentation Thanks! 0 -
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: - ]
- Copy the /usr/local/cpanel/etc/icontact_templates/include/ directory to the /var/cpanel/templates/icontact_templates custom templates directory.
- Copy the /usr/local/cpanel/etc/icontact_templates/wrapper/ directory to the /var/cpanel/templates/icontact_templates custom templates directory.
- 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.
0 -
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.0 -
I've followed the updated documentation but am receiving the following log message using WHM v68.0.36 on CENTOS 6.9 [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?0 -
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. 0 -
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/quotacheck0 -
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. 0 -
Done, my request ID is 9428443 0 -
Hello, To update, it looks like this was solved by rebuilding the template cache with the following command: /usr/local/cpanel/bin/rebuild-templates
Thank you.0 -
Hello, To update, it looks like this was solved by rebuilding the template cache with the following command:
/usr/local/cpanel/bin/rebuild-templates
Thank you.
Please add this to the documentation here: Notification Templates - Version 68 Documentation - cPanel Documentation This will save others a lot of time trying to figure out why changes are not taken effect. Thanks!0 -
Hello @bmett, You shouldn't need to run the /usr/local/cpanel/bin/rebuild-templates command after customizing a template. It looks like that was only required due to a mistake in how the custom template was originally configured (due to a mistake in the documented example). We've now updated the example instructions for customizing the notification templates as part of Documentation case DOC-10645: Notification Templates - Version 70 Documentation - cPanel Documentation Thank you. 0
Please sign in to leave a comment.
Comments
23 comments