Jump to content

localAPI and SendEmail not sending anything


Jbl

Recommended Posts

I wanted to send an email on InvoicePaid so I wrote a hook like this:

 

function add_client($vars) {    
		$userid = Capsule::table('tblorders')->where('invoiceid', '=', $vars['invoiceid'])->value('userid');  

		$command = 'SendEmail';
		
		$postData = array(
				'//example1' => 'example',
				'messagename' => 'Access Info',
				'id' => $userid,
				'//example2' => 'example',
				'customtype' => 'product',
				'customsubject' => 'Product Welcome Email',
				'custommessage' => '<p>Thank you for choosing us</p><p>Your custom is appreciated</p><p>{$custommerge}<br />{$custommerge2}</p>'  );

		$adminUsername = 'admin'; // Optional for WHMCS 7.2 and later
		
		$results = localAPI($command, $postData, $adminUsername);
		
		print_r($results);}
}

 

add_hook("InvoicePaid",1,"add_client")

 

And a custom email template named Access Info with arbitrary text.

 

This returns:

Array
(
    [result] => success
)

but no email is being sent.

There is even no trace of the email in the system email message log. Other emails like Order Confirmation and Invoice Payment Confirmation are sent, so the mail configuration is not the issue here.

I'm I missing something?
 

 

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