1 – Create an application of type Control
2 – We proceed to create the necessary fields for sending an email.
To create a new field, we must click in the button new field and select the quantity of field
Note: we will use these fields to generate the application.
3 – In the OnValidateSuccess event we proceed to add the following code
function explodeMail($str, $type)
{
$arr = explode(',', $str);
$arr_return = [];
foreach ($arr as $item) {
$arr_return[] = array(
'name' => '',
'type' => $type,
'email' => $item
);
}
return $arr_return;
}
$arr_to = explodeMail({mail_to}, 'to');
if ( !empty({to_cc}) ) { $arr_cc = explodeMail({to_cc}, 'cc'); } else {$arr_cc = array();}
if ( !empty({to_bcc}) ) { $arr_bcc = explodeMail({to_bcc}, 'bcc'); } else {$arr_bcc = array();}
$arr_merge = array_merge($arr_to, $arr_cc, $arr_bcc);
$txt_no_tags = strip_tags({msg});
if ({api_type} == 'smtp') {
// SMTP Settings
$var_config = get_settings_smtp($txt_no_tags, $arr_merge);
} elseif ({api_type} == 'mandrill') {
// MANDRILL Settings
$var_config = get_settings_mandrill($txt_no_tags, $arr_merge);
} elseif ({api_type} == 'ses') {
// AMAZON SES Settings
$var_config = get_settings_amazon($txt_no_tags, $arr_merge);
}
//echo "<pre>";
//print_r($var_config);
//echo "</pre>";
sc_send_mail_api($var_config);
sc_alert({lang_othr_grid_export_email_sent});
4 – We proceed to create a field called api_type to verify what type of shipment we will use and then perform a manual lookup.
5 – We proceed to create another smtp_protocol field, where a manual lookup is performed for the use of SSL or TLS
6 – Once finished we can load the data in the created fields.
Comment this post