$resp1, "resp2" => $resp2]); Utils_WriteFile("/mnt/appfactorystudio/tmp/tmpfile3.json",$resp3); }); }); }); // $db = new DB(); // $rows = $db->query("SELECT * FROM general_data_storage WHERE name='$param2'",[],PDO::FETCH_ASSOC); // if($rows->count() > 0){ // $mydata = $rows->results()[0]; // $mydata["json"] = html_entity_decode($mydata["json"]); // $otherdata = json_decode($mydata["json"], true); // $otherdata["mail_handlers"]["email_response"]["integration"] = $integration; // $otherdata["mail_handlers"]["email_confirm"]["integration"] = $integration; // // EchoJsonObject(["data" => json_last_error(), "param" => $param2, "count" => $rows->count()]); // SendEmailBuilder($otherdata["mail_handlers"]["email_response"],$managed_domain, function($resp1) use($otherdata,$managed_domain) { // SendEmailBuilder($otherdata["mail_handlers"]["email_confirm"],$managed_domain, function($resp2) use($otherdata,$managed_domain,$resp1){ // EchoJsonObject(["mail_handlers" => $otherdata, "resp1" => $resp1, "resp2" => $resp2]); // }); // }); // // EchoJsonResponse("Sending..."); // }else{ // EchoJsonResponse("No record found"); // } // $db = null; } function _sendEmail2($param2,$param3 ){ $config_domain = __get_main_configurations(); $managed_domain = $config_domain["managed_domain"]; $config = $config_domain["configurations"]; $integration = GetActiveEmailIntegration($config); if($integration==null){ EchoJsonResponse("Email integration is null!"); return; } $otherdata = json_decode(file_get_contents($param3), true); foreach ($otherdata["mail_handlers"] as $key => $value) { // $value[$key]["integration"] = $integration; $otherdata["mail_handlers"][$key]["integration"] = $integration; $mail = $otherdata["mail_handlers"][$key]; SendEmailBuilder($mail,$managed_domain, function($resp) use($otherdata,$managed_domain,$key){ EchoJsonObject(["resp1" => $resp["emails"]]); }); } } if($param1=="send_email"){ require dirname( __DIR__,4 ) . "/core/api/php/includes/init.php"; require dirname( __DIR__,4 ) . "/core/api/php/includes/functions.php"; $param2 = $argv[2]; $param3 = $argv[3]; _sendEmail($param2,$param3); } if($param1=="send_email2"){ require dirname( __DIR__,4 ) . "/core/api/php/includes/init.php"; require dirname( __DIR__,4 ) . "/core/api/php/includes/functions.php"; $param2 = $argv[2]; $param3 = $argv[3]; _sendEmail2($param2,$param3); }