PHP

Choose Language

SMTP Users Calls

Info! Do you have any questions on our Email API? Write to us at support@sendclean.com

/settings/addSmtp

Add a new SMTP User

Example Call


<?php
    try {
        require_once 'SendCleanMTA_PHP/SendClean.php';
        $SendClean= new SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN');
        $result = $SendClean->settings->addSmtpUser(total_limit, hourly_limit);
        print_r($result);
        /*
        Array
        (
            [status] => "success"
            [message] => "SMTP User Created"
            [smtp_user_name] => "smtp12345"
            [smtp_password] => "asfsf4w343"
        )
        */
    } catch(SendClean_Error $e) {
        // SendCleanerrors are thrown as exceptions
        echo "A SendCleanerror occurred: " . get_class($e) . " - " . $e->getMessage();
    }
?>

Example Success Response


Array
(
    [status] => "success"
    [message] => "SMTP User Created"
    [smtp_user_name] => "smtp12345"
    [smtp_password] => "asfsf4w343"
)

Example Error Response


Array
(
    [status]=> "error"
    [code]=> -1
    [name]=> "AuthenticationError"
    [message]=> "Token MissMatch"
)

Parameters
owner_id* string a valid SendCleanUser Id
token* string a valid token
SendCleanTES_APP_DOMAIN* string a valid SendCleanTES APP DOMAIN
total_limit* integer positive digit
hourly_limit* integer positive digit
* compulsory field
Return Value: Success
struct the results of newly created SMTP user
status string always success
message string human readable message
smtp_user_name string smtp user name
smtp_password string smtp password
Return Value: Error
struct the error results when attempt to create smtp user
status string error
message string human readable message
type string one of the error type as bellow table
Error types
ValidationError The parameters passed to the API call are invalid or not provided when required.
GeneralError An unexpected errors occurred processing the request. SendCleanDevelopers will be notified.
AuthenticationError Provided owner_id and token was not matched.

/settings/editSmtp

Edit SMTP User

Example Call


<?php
    try {
        require_once 'SendCleanMTA_PHP/SendClean.php';
        $SendClean= new SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN');
        $result = $SendClean->settings->editSmtp(smtp_user_name, total_limit, hourly_limit, status);
        print_r($result);
        /*
        Array
        (
            [status] => "success"
            [message] => "SMTP User Updated"
        )
        */
    } catch(SendClean_Error $e) {
        // SendCleanerrors are thrown as exceptions
        echo "A SendCleanerror occurred: " . get_class($e) . " - " . $e->getMessage();
    }
?>

Example Response Success


Array
(
    [status]=> "success"
    [message]=> "SMTP User Updated"
)

Example Error Response JSON


Array
(
    [status]=> "error"
    [code]=> -1
    [name]=> "AuthenticationError"
    [message]=> "Token MissMatch"
)

Parameters
owner_id* string a valid SendCleanUser Id
token* string a valid token
SendCleanTES_APP_DOMAIN* string a valid SendCleanTES APP DOMAIN
smtp_user_name* string a valid smtp user name
total_limit integer positive digit
hourly_limit integer positive digit
status string value of status is Either 'Enable' OR 'Disable'
* compulsory field
Return Value: Success
struct the results of updated SMTP user
status string always success
message string human readable message
Return Value: Error
struct the error results when attempt to update smtp user details
status string error
message string human readable message
type string one of the error type as bellow table
Error types
ValidationError The parameters passed to the API call are invalid or not provided when required.
GeneralError An unexpected errors occurred processing the request. SendCleanDevelopers will be notified.
AuthenticationError Provided owner_id and token was not matched.

/settings/resetSmtpPassword

Password Reset for SMTP user

Example Request JSON


<?php
    try {
        require_once 'SendCleanMTA_PHP/SendClean.php';
        $SendClean= new SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN');
        $result = $SendClean->settings->resetSmtpPassword(smtp_user_name);
        print_r($result);
        /*
        Array
        (
            [status] => "success"
            [message] => "password reseted"
            [smtp_user_name] => "smtp12345"
            [smtp_password] => "2fg345gy6r7"
        )
        */
    } catch(SendClean_Error $e) {
        // SendCleanerrors are thrown as exceptions
        echo "A SendCleanerror occurred: " . get_class($e) . " - " . $e->getMessage();
    }
?>

Example Success Response


Array
(
    [status] => "success"
    [message] => "password reseted"
    [smtp_user_name] => "smtp12345"
    [smtp_password] => "2fg345gy6r7"
)

Example Error Response


Array
(
    [status]=> "error"
    [code]=> -1
    [name]=> "AuthenticationError"
    [message]=> "Token MissMatch"
)

Parameters
owner_id* string a valid SendCleanUser Id
token* string a valid token
SendCleanTES_APP_DOMAIN* string a valid SendCleanTES APP DOMAIN
smtp_user_name* string a valid smtp user name
* compulsory field
Return Value:Success
struct the results of password reset for SMTP user
status string always success
message string human readable message
smtp_user_name string smtp user name
smtp_password string new smtp password
Return Value: Error
struct the error results when attempt to reset password for smtp user
status string error
message string human readable message
type string one of the error type as bellow table
Error types
ValidationError The parameters passed to the API call are invalid or not provided when required.
GeneralError An unexpected errors occurred processing the request. SendCleanDevelopers will be notified.
AuthenticationError Provided owner_id and token was not matched.

/settings/listSmtp

List SMTP users

Example Request JSON


<?php
    try {
        require_once 'SendCleanMTA_PHP/SendClean.php';
        $SendClean= new SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN');
        $result = $SendClean->settings->listSmtp();
        print_r($result);
        /*
        Array
        (
            [status] => "success"
            [smtp_list] => array(
                                array(
                                    [smtp_user_name] => "smtps456546"
                                    [password] => "cgvddgrsd"
                                    [status] => "Enable"
                                    [total_limit] => 200
                                    [hourly_limit] => 20
                                ),
                                array(
                                    [smtp_user_name] => "smtps456567"
                                    [password] => "fdsdfs"
                                    [status] => "Disable"
                                    [total_limit] => 100
                                    [hourly_limit] => 30
                                )
                            )
        )
        */
    } catch(SendClean_Error $e) {
        // SendCleanerrors are thrown as exceptions
        echo "A SendCleanerror occurred: " . get_class($e) . " - " . $e->getMessage();
    }
?>

Example Response JSON


Array
(
    [status] => "success"
    [smtp_list] => array(
                        array(
                            [smtp_user_name] => "smtps456546"
                            [password] => "cgvddgrsd"
                            [status] => "Enable"
                            [total_limit] => 200
                            [hourly_limit] => 20
                        ),
                        array(
                            [smtp_user_name] => "smtps456567"
                            [password] => "fdsdfs"
                            [status] => "Disable"
                            [total_limit] => 100
                            [hourly_limit] => 30
                        )
                    )
)

Example Error Response JSON


Array
(
    [status]=> "error"
    [code]=> -1
    [name]=> "AuthenticationError"
    [message]=> "Token MissMatch"
)

Parameters
owner_id* string a valid SendCleanUser Id
token* string a valid token
SendCleanTES_APP_DOMAIN* string a valid SendCleanTES APP DOMAIN
* compulsory field
Return Value: Success
struct the results of List SMTP user
status string always success
message string human readable message
smtp_list[]struct information of single smtp user
smtp_user_name string smtp user name
smtp_password string smtp password
total_limit integer positive digit
hourly_limit integer positive digit
status integer value of status is Either 'Enable' OR 'Disable'
Return Value: Error
struct the error results when attempt to list smtp user
status string error
message string human readable message
type string one of the error type as bellow table
Error types
ValidationError The parameters passed to the API call are invalid or not provided when required.
GeneralError An unexpected errors occurred processing the request. SendCleanDevelopers will be notified.
AuthenticationError Provided owner_id and token was not matched.