Jump to content

There is issue in sendAdminEmail


malin

Recommended Posts

<?php
/**
 * Created by PhpStorm.
 * User: ldl
 * Date: 2019/12/25
 * Time: 10:24 PM
 */



try {

    $mergefields = array(
        'client_id' => 3,
        'service_id' => 330,
        'service_product' => 'This is a product',
        'service_domain' => 'sampledomain.com'
    );

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, '../../includes/api.php');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,
        http_build_query(
            array(
                'action' => 'SendAdminEmail',
                // See https://developers.whmcs.com/api/authentication
                'username' => 'admin123',
                'password' => 'adminpwd',
                'messagename' => 'Dedicated/VPS Server Welcome Email',
                'mergefields' => $mergefields,//array('client_id' => 1, 'service_id' => 1, 'service_product' => 'This is a product', 'service_domain' => 'sampledomain.com'),
                'responsetype' => $responsetype,
            )
        )
    );

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    $response = curl_exec($ch);
    curl_close($ch);

    echo $response;

}catch (Exception $e) {
    echo $e;
    return;
}


    echo '200';
return;

 

You see my upper code in a `path-to-whmcs/admin/test05.php`, I follow the [API document](https://developers.whmcs.com/api-reference/sendadminemail/ 

But it send email fail, there  even echo `200`, but the `$response` is blank. there only echo `200`.

 

Who can tell me why there is issue in sendAdminEmail? 

 

 

 

 

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