Jump to content

AfterModuleRenew hook problem


hhpl

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated