hhpl Posted November 29, 2015 Share Posted November 29, 2015 if (!defined("WHMCS")) die("This file cannot be accessed directly"); function mail_after_renew($vars) { $emal = "my@mail.com"; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/plain; charset=UTF-8\r\nContent-Transfer-Encoding: 8bit\nX-Priority: 1\nX-MSMail-Priority: High\n"; $headers .= "From: my@hosname.com<$emal>\n" . "Reply-To: $emal\n" . "X-Mailer: PHP/" . phpversion() . "\nX-originating-IP: " . $_SERVER[REMOTE_ADDR] . "\n"; $userId = $vars['params']['userid']; $accountId = $vars['params']['accountid']; $domain = $vars['params']['domain']; $serverHostname = $vars['params']['serverhostname']; $subject = "Service renewed"; $message = "User".$userId." reneved service ".$accountId.""; mail($emal, #subject, $message, $headers); } add_hook("AfterModuleRenew",1,"mail_after_renew"); Do you have any idea why it does not work? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 29, 2015 Share Posted November 29, 2015 do you need to send email message to one of your clients or admin(s)? 0 Quote Link to comment Share on other sites More sharing options...
hhpl Posted November 29, 2015 Author Share Posted November 29, 2015 do you need to send email message to one of your clients or admin(s)? Only to admin. There is no any error, just not send any e-mail. PS. I know that in code is "#subject" (should be $subject), I couldn't edit post. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 29, 2015 Share Posted November 29, 2015 Only to admin. There is no any error, just not send any e-mail. PS. I know that in code is "#subject" (should be $subject), I couldn't edit post. send email using this API method: http://docs.whmcs.com/API:Send_Admin_Email 0 Quote Link to comment Share on other sites More sharing options...
hhpl Posted November 29, 2015 Author Share Posted November 29, 2015 if (!defined("WHMCS")) die("This file cannot be accessed directly"); function mail_after_renew($vars) { $emal = "my@mail.com"; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/plain; charset=UTF-8\r\nContent-Transfer-Encoding: 8bit\nX-Priority: 1\nX-MSMail-Priority: High\n"; $headers .= "From: my@hosname.com<$emal>\n" . "Reply-To: $emal\n" . "X-Mailer: PHP/" . phpversion() . "\nX-originating-IP: " . $_SERVER[REMOTE_ADDR] . "\n"; $userId = $vars['params']['userid']; $accountId = $vars['params']['accountid']; $domain = $vars['params']['domain']; $serverHostname = $vars['params']['serverhostname']; $subject = "Service renewed"; $message = "User".$userId." reneved service ".$accountId.""; $command = "sendadminemail"; $adminuser = "admin"; $values["mergefields"] = array( "client_name" => "Test Client", "client_id" => 1, "ticket_id" => 1, "ticket_department" => "Support", "ticket_subject" => "Test Ticket", "ticket_priority" => "Medium", "ticket_message" => "This is a test ticket"); $values["type"] = "support"; $values["deptid"] = 1; $results = localAPI($command,$values,$adminuser); } add_hook("AfterModuleRenew",1,"mail_after_renew"); Still nothing. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 29, 2015 Share Posted November 29, 2015 check this: <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function mail_after_renew($vars) { # Enter Valid Admin Username here $adminuser = "admin"; $userId = $vars['params']['userid']; $accountId = $vars['params']['accountid']; $domain = $vars['params']['domain']; $serverHostname = $vars['params']['serverhostname']; $command = "sendadminemail"; $values["mergefields"] = array(); $values['customsubject'] = "Service renewed"; $values['custommessage'] = "User".$userId." reneved service ".$accountId.""; $values["type"] = "account"; $results = localAPI($command,$values,$adminuser); } add_hook("AfterModuleRenew",1,"mail_after_renew"); 0 Quote Link to comment Share on other sites More sharing options...
hhpl Posted November 29, 2015 Author Share Posted November 29, 2015 No result 0 Quote Link to comment Share on other sites More sharing options...
nimonogi Posted November 29, 2015 Share Posted November 29, 2015 Did you enter a valid admin username? 0 Quote Link to comment Share on other sites More sharing options...
hhpl Posted November 29, 2015 Author Share Posted November 29, 2015 Did you enter a valid admin username? Of course. 0 Quote Link to comment Share on other sites More sharing options...
HardSoftCode Posted November 30, 2015 Share Posted November 30, 2015 Hi Change $values["type"] = "account"; to $values["type"] = "system"; 0 Quote Link to comment Share on other sites More sharing options...
hhpl Posted November 30, 2015 Author Share Posted November 30, 2015 Still nothing. It looks like a WHMCS bug... 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.