|
It allows us to use the APIs integrated with Scriptcase. We currently offer integration with the Mandrill and Amazon SES APIs.
This macro has two parameters:
| Parameters |
Description |
| $profile |
Required parameter. Can be passed empty '' or contain the name of the gateway configured in "Tools > API". |
| $arr_settings |
This parameter is optional, as long as the "profile" is not empty. When informed, this parameter must contain an Array with the Gateway used and the API key. |
Example 1 - Parameter settings, array with API information.
$settings = array( 'settings' => ['gateway' => 'mandrill', 'api_key'=> {api_key}] );
$mandrill = sc_call_api('', $settings);
Example 2 - Sending e-mail using mandrill.
$txt_no_tags = strip_tags({body});
$arr_merge = array(
'name' => '',
'type' => 'to',
'email' => 'example@exemple.com'
);
$var_config = array( 'settings' => ['gateway' => 'mandrill', 'api_key'=> {api_key}] );
$mandrill = sc_call_api('', $var_config);
$var_msg = array(
'from_email' => {from_email},
'from_name' => {from_name},
'html' => {body},
'text' => $txt_no_tags,
'to' => array($arr_merge),
'subject' => {subject},
'important' => true,
'auto_text' => null,
'auto_html' => null,
'inline_css' => null,
'metadata' => array('website' => 'www.scriptcase.net')
);
$async = false;
$return = $mandrill->messages->send($var_msg, $async);
|