The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

customizing system generated email notifications

Discussion in 'User Experience' started by nwd, Sep 17, 2015.

  1. nwd

    nwd Member

    Joined:
    Feb 28, 2014
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    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?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    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.
     
  3. nwd

    nwd Member

    Joined:
    Feb 28, 2014
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    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.
     

    Attached Files:

  4. cPAndrewHodge

    cPAndrewHodge cPanel UI Developer
    Staff Member

    Joined:
    Dec 10, 2012
    Messages:
    52
    Likes Received:
    3
    Trophy Points:
    8
    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.
     
    nwd likes this.
  5. nwd

    nwd Member

    Joined:
    Feb 28, 2014
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    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
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  7. nwd

    nwd Member

    Joined:
    Feb 28, 2014
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    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
     
    #7 nwd, Oct 15, 2015
    Last edited: Oct 15, 2015
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  9. nwd

    nwd Member

    Joined:
    Feb 28, 2014
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    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 => 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.
     
    #9 nwd, Apr 30, 2016
    Last edited: Apr 30, 2016
  10. nwd

    nwd Member

    Joined:
    Feb 28, 2014
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    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!
     

    Attached Files:

  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  12. Benbodhi

    Benbodhi Registered

    Joined:
    Sep 8, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    cPanel Access Level:
    Root Administrator
    Any idea when the documentation will be updated?
     
  13. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     

Share This Page