Edit Email Templates

Use the Edit Email Templates API to edit the email templates present on the server. These include content of the email, which will be sent to the admin/user when operations such as creation of VPS and deletion of VPS takes place. You can modify the templates to include company information in the emails. The API response will contain “done” as “1” after successful update of the email template.

HTTP Request

https://hostname:4085/index.php?act=editemailtemp&temp=TEMP

Parameters

NameMethodValueDescriptionRequired
actGETeditemailtempThe action will edit the email templateYes
tempPOSTtextThe template name that needs to be editedYes
savetemplatePOST1/0If set then the new template will be setYes
tempsubPOSTtextThis will update the subject of the email templateYes
tempcontentPOSTtextThis will update the content of the email templateYes

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['temp'] = 'unsuspend_users';
    $post['savetemplate'] = 1;
    $post['tempsub'] = 'Test editing with API'; 
    $post['tempcontent'] = 'Email template test';   

    $output = $admin->editemailtemp($post);

    print_r(json_encode($output));
?>

Output

{
    "title": "Edit Email Template",
    "done": "1",
    "emailtemp": "null",
    "timenow": "1480485898",
    "time_taken": "0.104"
}
Was this helpful to you?