Jump to content

I use below code to sendAdminEmail of `Dedicated/VPS Server Welcome Email` .


malin

Recommended Posts

 $client_id = $mergefields['client_id'];
    $service_id = $mergefields['service_id'];
    $service_product_name = $mergefields['service_product'];

    $service_obj = Capsule::select("
        SELECT * FROM tblhosting WHERE id = $service_id
    ");

    $client_obj = Capsule::select("
        SELECT * FROM tblclients WHERE id = $client_id
    ");


    if(count($client_obj) == 0) {
        echo gen_return_json(400, array(
            "msg" => 'there is no this client'
        ));
        return;
    }

    if(count($service_obj) == 0) {
        echo gen_return_json(400, array(
            "msg" => 'there is no this service'
        ));
        return;
    }


//    echo gen_return_json(
//        200,
//        array(
//            ' $messagename' =>  $messagename
//        )
//    );
//    return;


    $command = 'SendAdminEmail';
    $postData = array(
        'messagename' => 'Dedicated/VPS Server Welcome Email',//$messagename, 
        'mergefields' => array(
            'client_id' => 3,//$client_obj[0] -> id,
            'client_name' => $service_obj[0] -> firstname . $service_obj[0] -> lastname ,
            'service_product_name' => $service_product_name,
            'service_domain' => $service_obj[0] -> domain,
            'service_dedicated_ip' =>  $service_obj[0] -> dedicatedip,
            'service_assigned_ips' =>  $service_obj[0] -> assignedips,
            'service_password' => decrypt($service_obj[0] -> password),
            'service_ns1' => $service_obj[0] -> service_ns1,
            'service_ns2' => $service_obj[0] -> service_ns2
        ),
    );
    $adminUsername = 'admin123'; // Optional for WHMCS 7.2 and later

    $results = localAPI($command, $postData, $adminUsername);

    echo gen_return_json(
        200,
        array(
            'sendemail_response' => $results
        )
    );
    return;

 

But however, I get `Email Template not found` error:  

```

{"sendemail_response":{"result":"error","message":"Email Template not found"}}}

```

I promise there exists this email template:

 

image.thumb.png.20952614ad638daa5902eb9ec7e876cf.png

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