Hello,
On the documentation for the WHMCS API - http://docs.whmcs.com/API:Send_Email it states:
The following email templates cannot be sent in this way:
Automated Password Reset
Password Reset Confirmation
Password Reset Validation
...
However i am able to perform these actions, below is a code snippet:
public function resetAction()
{
$request = $this->getRequest();
if ( $request->isPost() )
{
$params['action'] = 'getclientsdetails';
$params['email'] = $request->getPost( 'email' );
$reset = $this->backend->apiCall( $params );
if ( $reset->result == 'success' )
{
$params['action'] = 'sendemail';
$params['messagename'] = 'Password Reset Validation';
$params['id'] = $reset->userid;
$params['customvars'] = base64_encode(serialize([
'pw_reset_url' => 'http://domain.tld/page/args...'
]));
$this->backend->apiCall( $params );
}
$this->getView()->assign( 'done', 1 );
}
}
This piece of code simply sends a email to WHMCS via the api, upon success we get the users client id to pass to the
send e-mail command.
This works well and using the templates i am able to build a password recovery system using the api but what im wondering is if i am missing something because the documentation is stating that these templates cannot be used.
Thanks