TBroMEM Posted July 31 Share Posted July 31 (edited) RESOLVED: It did not like the 'customtype' defined in the postdata, give I supplied an existing template (I suppose). Remarking that out resolved (updated below). This is the code I have in place. It is triggering after AfterModuleTerminate, but not sending email and logging activity. In the logactivity result, the values for $serviceid and $clientid are showing anticipated values. I am trying another pass with 'customtype' => 'product', remarked out. Any ideas. I only recently added the $adminUsername to see if it would resolve but same issue. We are on 8.13.1. <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function send_termination_notice($vars) { try { $serviceid = $vars['params']['serviceid']; $emailtemplate = 'Service Termination Notification'; $clientid = $vars['params']['userid']; $command = 'SendEmail'; $postData = array( 'messagename' => $emailtemplate, 'id' => $serviceid, //'customtype' => 'product',// functions properly with this parameter remarked out ); $adminUsername = 'admin.usersample'; // Optional for WHMCS 7.2 and later $results = localAPI($command, $postData, $adminUsername); if ($results['result'] != 'success') { logActivity('Termination Notice failed to send for serviceid ' . $serviceid . ' for clientid ' . $clientid . ' by hook send_terminatio_notice...'); } } catch (\Exception $e) { logActivity("Termination notice failed: {$e->getMessage()}"); } } add_hook('AfterModuleTerminate', 1,'send_termination_notice'); Edited July 31 by TBroMEM Noting Resolution 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.