PARAMS (JSON ARRAY)
- Required Parameter 'action' = sendmail.
- Required Parameter 'key' = [API KEY]. Obtain the key from the admin.
- Required Array name 'maildata' with name array (to_list, subject, message, optional[cc_list, bcc_list]).
- Conditional Array name 'mailsetting' with name array (optional[(server, id, password)], optional[name, security(0/tls/ssl), port]).
RESPONCE (JSON ARRAY)
- On Sucess:
- sucess: true;
- message: [Sucess Related Message]
- HTTP RESPONCE = HTTP/1.1 200 OK
- On Failier:
- sucess: false;
- error: [Error Related Message]
- HTTP RESPONCE = HTTP/1.1 400 Bad Request
CODE EXAMPLE
// Set Required Data Variables ----------------------------
$data = array();
$to = array('John Doe' => 'johndoe@abc.com',
'Jay Doe' => 'jaydoe@xyz.com,
);
/*
* Or you can send just csv list of emails.
* $to = "johndoe@abc.com,jaydoe@xyz.com";
*/
$maildata = array(
'to_list' => $to,
'subject' => '[YOUR SUBJECT]',
'message' => '[YOUR HTML OR PLAIN TEXT MESSAGE]',
);
$data['maildata'] = $maildata;
// Set Action Parameter -----------------------------------
$data['action'] = 'sendmail';
// Set Key Value ------------------------------------------
$data['key'] = '[YOUR API KEY]';
// JSONify Data -------------------------------------------
$data_string = json_encode($data);
// CURL POST Data -----------------------------------------
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, 'http://api.mail.sabaseo.com/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
// Capture CURL Result ------------------------------------
$result = curl_exec($ch);
// Close CURL ---------------------------------------------
curl_close($ch);