public static function test_strings()
    {
        //--
        $unicode_text = '"Unicode78źź:ăĂîÎâÂșȘțȚşŞţŢグッド';
        //--
        $idn_domain_unicode = 'jösefsson.tßst123.org';
        $idn_domain_iso = 'xn--jsefsson-n4a.xn--tst123-bta.org';
        $idn_email_unicode = 'räksmörgås@jösefsson.tßst123.org';
        $idn_email_iso = '*****@*****.**';
        //--
        //--
        $err = '';
        //--
        //--
        $tests[] = '##### Unicode STRING / TESTS: #####';
        //--
        //--
        $regex_positive = '/^[\\w"\\:\\?]+$/';
        $regex_negative = '/[^\\w"\\:\\?]/';
        //--
        //--
        if (defined('SMART_FRAMEWORK_SECURITY_FILTER_INPUT')) {
            if ((string) SMART_FRAMEWORK_SECURITY_FILTER_INPUT != '') {
                if ((string) $err == '') {
                    $the_test = 'Smart.Framework Security Input Filter Regex - test over a full Unicode String';
                    $tests[] = $the_test;
                    if (preg_match((string) SMART_FRAMEWORK_SECURITY_FILTER_INPUT, 'Platform クラウドアプリケーションプラットフォーム \'áâãäåāăąÁÂÃÄÅĀĂĄćĉčçĆĈČÇďĎèéêëēĕėěęÈÉÊËĒĔĖĚĘĝģĜĢĥħĤĦìíîïĩīĭȉȋįÌÍÎÏĨĪĬȈȊĮijĵIJĴķĶĺļľłĹĻĽŁñńņňÑŃŅŇòóôõöōŏőøœÒÓÔÕÖŌŎŐØŒŕŗřŔŖŘșşšśŝßȘŞŠŚŜțţťȚŢŤùúûüũūŭůűųÙÚÛÜŨŪŬŮŰŲŵŴẏỳŷÿýẎỲŶŸÝźżžŹŻŽ " <p></p> ? & * ^ $ @ ! ` ~ % () [] {} | \\ / + - _ : ; , . #\'0.51085600 1454529112#' . "\r\n\t" . '`~@#$%^&*()-_=+[{]}|;:"<>,.?/\\')) {
                        $err = 'ERROR: ' . $the_test . ' FAILED ...';
                    }
                    //end if
                }
                //end if
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            $the_test = 'Unicode Regex Test Positive';
            $tests[] = $the_test;
            if (!preg_match((string) $regex_positive . 'u', (string) $unicode_text)) {
                $err = 'ERROR: ' . $the_test . ' FAILED (1) ...';
            } elseif (preg_match((string) $regex_positive, (string) $unicode_text)) {
                $err = 'ERROR: ' . $the_test . ' FAILED (2) ...';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            $the_test = 'Unicode Regex Test Negative';
            $tests[] = $the_test;
            if (preg_match((string) $regex_negative . 'u', (string) $unicode_text)) {
                $err = 'ERROR: ' . $the_test . ' FAILED (1) ...';
            } elseif (!preg_match((string) $regex_negative, (string) $unicode_text)) {
                $err = 'ERROR: ' . $the_test . ' FAILED (2) ...';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            $the_test = 'Deaccented ISO Regex Test Positive';
            $tests[] = $the_test;
            if (!preg_match((string) $regex_positive, (string) SmartUnicode::deaccent_str($unicode_text))) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            $the_test = 'Deaccented ISO Regex Test Negative';
            $tests[] = $the_test;
            if (preg_match((string) $regex_negative, (string) SmartUnicode::deaccent_str($unicode_text))) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'Unicode Strlen Test';
            $tests[] = $the_test;
            if (SmartUnicode::str_len($unicode_text) !== 30) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            // this tests also SmartUnicode::str_ipos
            $the_test = 'Unicode Find Substring (Case Insensitive), Positive';
            $tests[] = $the_test;
            if (SmartUnicode::str_icontains($unicode_text, 'șș') !== true) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            // this tests also SmartUnicode::str_ipos
            $the_test = 'Unicode Find Substring (Case Insensitive), Negative';
            $tests[] = $the_test;
            if (SmartUnicode::str_icontains($unicode_text, 'șş') !== false) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            // this tests also SmartUnicode::str_pos
            $the_test = 'Unicode Find Substring (Case Sensitive), Positive';
            $tests[] = $the_test;
            if (SmartUnicode::str_contains($unicode_text, 'țȚ') !== true) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            // this tests also SmartUnicode::str_pos
            $the_test = 'Unicode Find Substring (Case Sensitive), Negative';
            $tests[] = $the_test;
            if (SmartUnicode::str_contains($unicode_text, 'țŢ') !== false) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'Unicode Find Substring (Case Insensitive), Reverse';
            $tests[] = $the_test;
            if (SmartUnicode::str_ripos($unicode_text, 'ţţグ') === false) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            $the_test = 'Unicode Find Substring (Case Sensitive), Reverse';
            $tests[] = $the_test;
            if (SmartUnicode::str_rpos($unicode_text, 'ţŢグ') === false) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'Unicode Return Substring (Case Insensitive)';
            $tests[] = $the_test;
            if (SmartUnicode::stri_str($unicode_text, 'âȘșȚ') !== 'ÂșȘțȚşŞţŢグッド') {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            $the_test = 'Unicode Return Substring (Case Sensitive)';
            $tests[] = $the_test;
            if (SmartUnicode::str_str($unicode_text, 'ÂșȘț') !== 'ÂșȘțȚşŞţŢグッド') {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'Unicode String to LowerCase';
            $tests[] = $the_test;
            if (SmartUnicode::str_tolower($unicode_text) !== '"unicode78źź:ăăîîââșșțțşşţţグッド') {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            $the_test = 'Unicode String to UpperCase';
            $tests[] = $the_test;
            if (SmartUnicode::str_toupper($unicode_text) !== '"UNICODE78ŹŹ:ĂĂÎÎÂÂȘȘȚȚŞŞŢŢグッド') {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'Unicode SubString function (without last param)';
            $tests[] = $the_test;
            if (SmartUnicode::sub_str($unicode_text, 25) !== 'ţŢグッド') {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            $the_test = 'Unicode SubString function (with last param)';
            $tests[] = $the_test;
            if (SmartUnicode::sub_str($unicode_text, 25, 3) !== 'ţŢグ') {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'Unicode SubString Count function';
            $tests[] = $the_test;
            if (SmartUnicode::substr_count($unicode_text, 'ţ') !== 1) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'Unicode String Replace with Limit (Case Sensitive)';
            $tests[] = $the_test;
            if (SmartUnicode::str_limit_replace('ź', '@', $unicode_text, 1) !== '"Unicode78@ź:ăĂîÎâÂșȘțȚşŞţŢグッド') {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            $the_test = 'String Replace without Limit (Case Sensitive)';
            $tests[] = $the_test;
            if (str_replace('ź', '@', $unicode_text) !== '"Unicode78@@:ăĂîÎâÂșȘțȚşŞţŢグッド') {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            /* This test fails if the replacements accented characters are different case than one find in string (upper/lower) ... */
            $the_test = 'String Replace without Limit (Case Insensitive) *** Only with unaccented replacements !!';
            $tests[] = $the_test;
            if (str_ireplace('E7', '@', $unicode_text) !== '"Unicod@8źź:ăĂîÎâÂșȘțȚşŞţŢグッド') {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'Deaccent String';
            $tests[] = $the_test;
            if (SmartUnicode::deaccent_str($unicode_text) !== '"Unicode78zz:aAiIaAsStTsStT???') {
                $err = 'ERROR: ' . $the_test . ' FAILED ...';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'YAML Unicode Test: Compose from Array / Parse from YAML';
            $tests[] = $the_test;
            $test_arr = array('@test' => 'Testing weird key characters', 'line1' => 'Some ISO-8859-1 String: @ # $ % ^ & * (\') _ - + = { [ ] } ; < ,. > / ? \\ |', 'line2' => 'Unicode (long) String: ' . $unicode_text . ' ' . SmartUnicode::str_toupper($unicode_text) . ' ' . $unicode_text . ' ' . SmartUnicode::str_tolower($unicode_text) . ' ' . $unicode_text . ' ' . SmartUnicode::deaccent_str($unicode_text) . ' ' . $unicode_text, $unicode_text => 'Unicode as Key', 'line3' => ['A' => 'b', 100, 'Thousand'], 'line4' => [1, 0.2, 3.0001], 'line5' => date('Y-m-d H:i:s'));
            $test_yaml = (string) '# start YAML (to test also comments)' . "\n" . (new SmartYamlConverter())->compose($test_arr) . "\n" . '# end YAML';
            $test_parr = (new SmartYamlConverter())->parse($test_yaml);
            if ($test_arr !== $test_parr) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...' . ' #ORIGINAL Array [' . print_r($test_arr, 1) . ']' . "\n\n" . '#YAML Array (from YAML String): ' . print_r($test_parr, 1) . "\n\n" . '#YAML String (from ORIGINAL Array): ' . "\n" . $test_yaml;
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'XML Unicode Test: Compose from Array / Parse from XML';
            $tests[] = $the_test;
            $test_arr = array('TEST' => 'Testing weird key characters', 'line1' => 'Some ISO-8859-1 String: @ # $ % ^ & * (\') _ - + = { [ ] } ; < ,. > / ? \\ |', 'line2' => 'Unicode (long) String: ' . $unicode_text . ' ' . SmartUnicode::str_toupper($unicode_text) . ' ' . $unicode_text . ' ' . SmartUnicode::str_tolower($unicode_text) . ' ' . $unicode_text . ' ' . SmartUnicode::deaccent_str($unicode_text) . ' ' . $unicode_text, 'line3' => ['A' => 'b', 'c' => 'D'], 'line4' => '', 'line5' => date('Y-m-d H:i:s'));
            $test_xml = (string) (new SmartXmlComposer())->transform($test_arr);
            $test_parr = (new SmartXmlParser())->transform($test_xml);
            if ($test_arr !== $test_parr) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...' . ' #ORIGINAL Array [' . print_r($test_arr, 1) . ']' . "\n\n" . '#XML Array (from XML String): ' . print_r($test_parr, 1) . "\n\n" . '#XML String (from ORIGINAL Array): ' . "\n" . $test_xml;
            }
            //end if
        }
        //end if
        //--
        $the_random_unicode_text = sha1($unicode_text . Smart::random_number(1000, 9999)) . '-' . $unicode_text . " \r\n\t" . '-' . Smart::uuid_10_num() . '-' . Smart::uuid_10_str() . '-' . Smart::uuid_10_seq();
        //--
        if ((string) $err == '') {
            $the_test = 'Data: Archive / Unarchive';
            $tests[] = $the_test;
            if (SmartUtils::data_unarchive(SmartUtils::data_archive($the_random_unicode_text)) !== (string) $the_random_unicode_text) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...' . ' [' . $the_random_unicode_text . ']';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'Cache: Archive / Unarchive';
            $tests[] = $the_test;
            if (SmartUtils::cache_variable_unarchive(SmartUtils::cache_variable_archive($the_random_unicode_text)) !== (string) $the_random_unicode_text) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...' . ' [' . $the_random_unicode_text . ']';
            }
            //end if
        }
        //end if
        //--
        //--
        if ((string) $err == '') {
            $the_test = 'IDN: Domain Punycode Encode UTF-8 to ISO';
            $tests[] = $the_test;
            if ((string) (new SmartPunycode())->encode($idn_domain_unicode) != (string) $idn_domain_iso) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...' . ' [' . $idn_domain_unicode . ' -> ' . $idn_domain_iso . ']';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            $the_test = 'IDN: Domain Punycode Decode ISO to UTF-8';
            $tests[] = $the_test;
            if ((string) (new SmartPunycode())->decode($idn_domain_iso) != (string) $idn_domain_unicode) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...' . ' [' . $idn_domain_iso . ' -> ' . $idn_domain_unicode . ']';
            }
            //end if
        }
        //end if
        //--
        if ((string) $err == '') {
            $the_test = 'IDN: Email Punycode Encode UTF-8 to ISO';
            $tests[] = $the_test;
            if ((string) (new SmartPunycode())->encode($idn_email_unicode) != (string) $idn_email_iso) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...' . ' [' . $idn_email_unicode . ' -> ' . $idn_email_iso . ']';
            }
            //end if
        }
        //end if
        if ((string) $err == '') {
            $the_test = 'IDN: Email Punycode Decode ISO to UTF-8';
            $tests[] = $the_test;
            if ((string) (new SmartPunycode())->decode($idn_email_iso) != (string) $idn_email_unicode) {
                $err = 'ERROR: ' . $the_test . ' FAILED ...' . ' [' . $idn_email_iso . ' -> ' . $idn_email_unicode . ']';
            }
            //end if
        }
        //end if
        //--
        //-- regex positive tests
        $arr_regex = ['number-integer' => [0, '75', '-101'], 'number-decimal' => [0, '0.0', '0.1', '75', '75.0', '75.1', '-555', '-555.0', '-555.1'], 'number-list-integer' => '1;2;30', 'number-list-decimal' => '1.0;2;30.44', 'url' => ['https://192.168.1.0', 'http://localhost', 'https://www.dom.ext', 'http://dom.ext/path?a=b&c=d%20#s'], 'domain' => ['domain.com', 'sdom.domain.org'], 'email' => ['root@localhost', '*****@*****.**', '*****@*****.**'], 'fax' => ['~+99-(0)999-123.456.78~'], 'macaddr' => ['00:0A:95:9d:68:16', '00-0a-95-9D-68-16'], 'ipv4' => ['192.168.0.1', '169.254.1.0', '1.0.0.1'], 'ipv6' => ['::1', '0000:0000:0000:0000:0000:0000:0000:0001', '2001:0db8:0000:0000:0000:ff00:0042:8329', '2001:dB8::2:1', '2001:db8::1', '3731:54:65fe:2::a7']];
        //--
        foreach ((array) $arr_regex as $key => $val) {
            //--
            if (is_array($val)) {
                for ($i = 0; $i < Smart::array_size($val); $i++) {
                    $the_test = 'Regex Validate Positive (#' . $i . '): ' . $key . ' [' . $val[$i] . ']';
                    $tests[] = $the_test;
                    if (SmartValidator::validate_string($val[$i], $key) !== true) {
                        $err = 'ERROR: ' . $the_test . ' FAILED ...';
                        break;
                    }
                    //end if
                    if (stripos((string) $key, 'number-') === 0 and stripos((string) $key, 'number-list-') === false) {
                        $the_test = 'Regex Validate Numeric Positive (#' . $i . '): ' . $key . ' [' . $val[$i] . ']';
                        $tests[] = $the_test;
                        if (SmartValidator::validate_numeric_integer_or_decimal_values($val[$i], $key) !== true) {
                            $err = 'ERROR: ' . $the_test . ' FAILED ...';
                            break;
                        }
                        //end if
                    }
                    //end if
                }
                //end for
            } else {
                $the_test = 'Regex Validate Positive: ' . $key . ' [' . $val . ']';
                $tests[] = $the_test;
                if (SmartValidator::validate_string($val, $key) !== true) {
                    $err = 'ERROR: ' . $the_test . ' FAILED ...';
                }
                //end if
                if (stripos((string) $key, 'number-') === 0 and stripos((string) $key, 'number-list-') === false) {
                    $the_test = 'Regex Validate Numeric Positive: ' . $key . ' [' . $val . ']';
                    $tests[] = $the_test;
                    if (SmartValidator::validate_numeric_integer_or_decimal_values($val, $key) !== true) {
                        $err = 'ERROR: ' . $the_test . ' FAILED ...';
                    }
                    //end if
                }
                //end if
            }
            //end if else
            //--
            if ((string) $err != '') {
                break;
            }
            //end if
            //--
        }
        //end foreach
        //--
        //-- regex negative tests
        $arr_regex = ['number-integer' => ['', '.', 'a9', '7B', '-9 ', ' -7'], 'number-decimal' => ['', '.0', '.1', '-.10', ' -7', '-9.0 '], 'number-list-integer' => '1;2.3;30', 'number-list-decimal' => '1.0;2;30.44a', 'url' => ['http:://192.168.1.0', 'https://local host', 'http:/www.dom.ext', 'https:dom.ext/path?a=b&c=d%20#s'], 'domain' => ['doMain.com', 's dom.domain.org', '.dom.ext', 'dom..ext', 'localhost', 'loc', 'dom.ext.'], 'email' => ['rooT@localhost', 'root@local host.loc', 'sometest-name.extra@do_m.ext'], 'fax' => ['~ +99-(0)999-123.456.78 ~'], 'macaddr' => ['00:0A:95:9z:68:16', '00-0Z-95-9D-68-16'], 'ipv4' => ['192.168.0.', '169..1.0', '1.0.1'], 'ipv6' => ['::x', '00z0:0000:0000:0000:0000:0000:0000:0001', '2001:0dx8:0000:0000:0000:ff00:0042:8329', '2001:WB8::2:1', '2001:@db8::1', '3731:54:65Qe:2::a7']];
        //--
        foreach ((array) $arr_regex as $key => $val) {
            //--
            if (is_array($val)) {
                for ($i = 0; $i < Smart::array_size($val); $i++) {
                    $the_test = 'Regex Validate Negative (#' . $i . '): ' . $key . ' [' . $val[$i] . ']';
                    $tests[] = $the_test;
                    if (SmartValidator::validate_string($val[$i], $key) === true) {
                        $err = 'ERROR: ' . $the_test . ' FAILED ...';
                        break;
                    }
                    //end if
                }
                //end for
            } else {
                $the_test = 'Regex Validate Negative: ' . $key . ' [' . $val . ']';
                $tests[] = $the_test;
                if (SmartValidator::validate_string($val, $key) === true) {
                    $err = 'ERROR: ' . $the_test . ' FAILED ...';
                }
                //end if
            }
            //end if else
            //--
            if ((string) $err != '') {
                break;
            }
            //end if
            //--
        }
        //end foreach
        //--
        //--
        $endtest = '##### END TESTS ... #####';
        //--
        //--
        if ((string) $err == '') {
            $img_sign = 'lib/core/img/sign_info.png';
            $img_check = 'lib/core/img/q_completed.png';
            $text_main = Smart::escape_js('<span style="color:#83B953;">Good ... Perfect &nbsp;&nbsp;&nbsp; :: &nbsp;&nbsp;&nbsp; グッド ... パーフェクト</span>');
            $text_info = Smart::escape_js('<h2><span style="color:#83B953;">All</span> the SmartFramework Unicode String <span style="color:#83B953;">Tests PASSED on PHP</span><hr></h2><span style="font-size:14px;">' . Smart::nl_2_br(Smart::escape_html(implode("\n" . '* ', $tests) . "\n" . $endtest)) . '</span>');
        } else {
            $img_sign = 'lib/core/img/sign_error.png';
            $img_check = 'lib/core/img/q_warning.png';
            $text_main = Smart::escape_js('<span style="color:#FF5500;">An ERROR occured ... &nbsp;&nbsp;&nbsp; :: &nbsp;&nbsp;&nbsp; エラーが発生しました ...</span>');
            $text_info = Smart::escape_js('<h2><span style="color:#FF5500;">A test FAILED</span> when testing Unicode String Tests.<span style="color:#FF5500;"><hr>FAILED Test Details</span>:</h2><br><h3>' . Smart::escape_html($tests[Smart::array_size($tests) - 1]) . '</h3><br><span style="font-size:14px;"><pre>' . Smart::escape_html($err) . '</pre></span>');
        }
        //end if else
        //--
        //--
        $html = <<<HTML
<h1>SmartFramework Unicode Strings Tests: DONE ...</h1>
<script type="text/javascript">
\tSmartJS_BrowserUtils.alert_Dialog(
\t\t'<img src="{$img_sign}" align="right"><h1>{$text_main}</h1><hr><span style="color:#333333;"><img src="{$img_check}" align="right">{$text_info}<br>',
\t\t'',
\t\t'Unicode String Test Suite for SmartFramework: PHP',
\t\t'725',
\t\t'425'
\t);
</script>
HTML;
        //--
        //--
        return $html;
        //--
    }
 public function send($do_send, $raw_message = '')
 {
     //--
     if (strlen($this->smtp_helo) <= 0) {
         // fix
         $this->smtp_helo = '127.0.0.1';
     }
     //end if
     //--
     $tmp_explode_arr = (array) explode('@', (string) $this->from);
     $tmp_name = trim($tmp_explode_arr[0]);
     // used for from name in the case it is empty
     $tmp_domain = trim($tmp_explode_arr[1]);
     // used for message ID
     //--
     if (strlen($this->namefrom) > 0) {
         $tmp_name = SmartUnicode::deaccent_str($this->namefrom);
     } else {
         $tmp_name = ucwords(str_replace(array('.', '-', '_'), array(' ', ' ', ' '), (string) $tmp_name));
     }
     //end if
     //--
     $this->mime_message = '';
     // init
     //--
     $this->mime_message .= 'Return-Path: ' . '<' . $this->from_return . '>' . "\r\n";
     $this->mime_message .= 'From: ' . $tmp_name . ' <' . $this->from . '>' . "\r\n";
     // [ucwords] is safe here as the name is ISO-8859-1 (1st part of email address)
     $this->mime_message .= 'Date: ' . date('D, d M Y H:i:s O') . "\r\n";
     $this->mime_message .= 'To: ' . $this->to . "\r\n";
     //--
     if (is_array($this->cc)) {
         for ($z = 0; $z < Smart::array_size($this->cc); $z++) {
             if (strlen($this->cc[$z]) > 0) {
                 $this->mime_message .= "Cc: " . $this->cc[$z] . "\r\n";
             }
             //end if
         }
         //end for
     } elseif (strlen($this->cc) > 0) {
         $this->mime_message .= "Cc: " . $this->cc . "\r\n";
     }
     //end if
     if ((string) $do_send != 'yes') {
         if (strlen($this->bcc) > 0) {
             $this->mime_message .= "BCc: " . $this->bcc . "\r\n";
         }
         //end if
     }
     //end if
     //--
     $this->mime_message .= "Subject: " . $this->prepare_subject($this->subject) . "\r\n";
     //--
     switch ((string) $this->priority) {
         case '1':
             $this->mime_message .= "X-Priority: " . '1' . "\r\n";
             //high
             break;
         case '5':
             $this->mime_message .= "X-Priority: " . '5' . "\r\n";
             //low
             break;
         case '3':
         default:
             $this->mime_message .= "X-Priority: " . '3' . "\r\n";
             //normal
     }
     //end switch
     //--
     $this->mime_message .= "X-Mailer: " . 'SmartFramework Mailer (' . SMART_FRAMEWORK_VERSION . ')' . "\r\n";
     $this->mime_message .= "MIME-Version: 1.0 " . '(SmartFramework Mime-Message v.2016.02.01)' . "\r\n";
     $this->mime_message .= "Message-Id: " . '<ID-' . Smart::uuid_10_seq() . '-' . Smart::uuid_10_str() . '-' . Smart::uuid_10_num() . '@' . Smart::safe_validname($tmp_domain) . '>' . "\r\n";
     //--
     if (strlen($this->headers) > 0) {
         $this->mime_message .= $this->headers;
         // must be end by \r\n
     }
     //end if
     //--
     if (strlen($raw_message) <= 0) {
         //--
         if (strlen($this->body) > 0) {
             //--
             if ($this->is_html == false) {
                 $this->add_attachment($this->body, '', 'text/plain', 'inline');
             } else {
                 $this->add_attachment('This is a MIME Message in HTML Format.', 'alternative-part.txt', 'text/plain', 'inline');
                 // antiSPAM needs an alternate body
                 $this->add_attachment($this->body, '', 'text/html', 'inline');
             }
             //end else
             //--
         }
         //end if
         //--
         $this->mime_message .= $this->build_multipart() . "\r\n";
         //--
     } else {
         //-- RAW (get as is)
         $this->mime_message .= $raw_message . "\r\n";
         //--
     }
     //end if else
     //--
     //--
     $err = '';
     //--
     if ((string) $do_send == 'yes') {
         //--
         if ((string) $this->method == 'mail') {
             //-- MAIL METHOD
             if ($this->debuglevel > 0) {
                 $this->log = 'SendMail :: DEBUG :: MAIL';
             }
             //end if
             //--
             if (SmartUnicode::mailsend($this->to, $this->prepare_subject($this->subject), '', $this->mime_message) != true) {
                 $err = 'Mail Method Failed !';
                 if ($this->debuglevel > 0) {
                     $this->log .= ' :: ' . $err;
                 }
                 //end if
             }
             //end if else
             //--
         } elseif ((string) $this->method == 'smtp') {
             //-- SMTP METHOD
             if ($this->debuglevel > 0) {
                 $this->log = 'SendMail :: DEBUG :: SMTP';
             }
             //end if
             //--
             $smtp = new SmartMailerSmtpClient();
             //--
             if ($this->debuglevel > 0) {
                 $smtp->debug = true;
                 $smtp->dbglevel = $this->debuglevel;
             } else {
                 $smtp->debug = false;
             }
             //end if
             //--
             $connect = $smtp->connect($this->smtp_helo, $this->smtp_server, $this->smtp_port, $this->smtp_ssl);
             //--
             if ($connect) {
                 //--
                 $login = 1;
                 // default
                 if ($this->smtp_login) {
                     $login = $smtp->login($this->smtp_user, $this->smtp_password);
                 }
                 //end if
                 //--
                 if ($login) {
                     //--
                     $vfy = $smtp->mail($this->from);
                     //--
                     if ($vfy) {
                         //--
                         $rcpt_to = $smtp->recipient($this->to);
                         //--
                         $rcpt_cc = 1;
                         if (is_array($this->cc)) {
                             for ($z = 0; $z < Smart::array_size($this->cc); $z++) {
                                 if (strlen($this->cc[$z]) > 0) {
                                     if ($rcpt_cc == 1) {
                                         $rcpt_cc = $smtp->recipient($this->cc[$z]);
                                     } else {
                                         break;
                                     }
                                     //end if
                                 }
                                 //end if
                             }
                             //end for
                         } elseif (strlen($this->cc) > 0) {
                             $rcpt_cc = $smtp->recipient((string) $this->cc);
                         }
                         //end if
                         //--
                         $rcpt_bcc = 1;
                         if (strlen($this->bcc) > 0) {
                             $rcpt_bcc = $smtp->recipient((string) $this->bcc);
                         }
                         //end if
                         //--
                         if ((string) $rcpt_to == '1' and (string) $rcpt_cc == '1' and (string) $rcpt_bcc == '1') {
                             //--
                             $sendresult = $smtp->data_send($this->mime_message);
                             //--
                             if ((string) $sendresult != '1') {
                                 $err = 'SMTP SEND-DATA :: ' . $smtp->error;
                             }
                             //end if
                             //--
                         } else {
                             //--
                             $err = 'SMTP RECIPIENT :: ' . $smtp->error;
                             //--
                         }
                         //end if
                         //--
                     } else {
                         //--
                         $err = 'SMTP MAIL :: ' . $smtp->error;
                         //--
                     }
                     //end if
                     //--
                 } else {
                     //--
                     $err = 'SMTP LOGIN :: ' . $smtp->error;
                     //--
                 }
                 //end if
                 //--
                 $smtp->noop();
                 //--
             } else {
                 //--
                 $err = 'SMTP CONNECT :: ' . $smtp->error;
                 //--
             }
             //end if
             //--
             if (strlen($err) > 0) {
                 $err = 'ERROR :: ' . $err;
             }
             //end if
             //--
             $smtp->quit();
             //--
             if ($this->debuglevel > 0) {
                 $this->log .= 'SMTP Log :: ' . $smtp->log;
             }
             //end if
             //--
         }
         //end else
         //--
     }
     //end if (send real)
     //--
     //--
     return $err;
     //--
 }
 public function __construct($y_type, $y_title, $y_arr_data, $y_format = 'png', $y_display_graph2 = true, $y_display_graph_depths = true)
 {
     //--
     if (!function_exists('imagecreatetruecolor')) {
         Smart::log_warning('"[ERROR] :: SmartImgGfxCharts :: PHP-GD TrueColor extension is missing ...');
         return;
     }
     //end if
     //--
     switch ((string) $y_type) {
         case 'vbars':
             $this->type = 1;
             break;
         case 'hbars':
             $this->type = 2;
             break;
         case 'dots':
             $this->type = 3;
             break;
         case 'lines':
             $this->type = 4;
             break;
         case 'pie':
             $this->type = 5;
             break;
         case 'donut':
             $this->type = 6;
             break;
         default:
             Smart::log_warning('"[ERROR] :: SmartImgBizCharts :: Invalid Chart Type: ' . $y_type . ' ...');
             return;
     }
     //end if
     //--
     $this->title = (string) SmartUnicode::deaccent_str((string) $y_title);
     //--
     if ((string) $y_format == 'gif') {
         $this->format = 'gif';
     } else {
         $this->format = 'png';
     }
     //end if else
     //--
     $this->skin = 1;
     // by now only this color schema !
     //--
     if (!is_array($y_arr_data)) {
         $y_arr_data = array();
     }
     //end if else
     //--
     $y_display_graph2 = (bool) $y_display_graph2;
     $y_display_graph_depths = (bool) $y_display_graph_depths;
     $this->x = $this->y = $this->z = $this->w = $this->v = array();
     //--
     for ($i = 0; $i < count($y_arr_data); $i++) {
         //--
         $tmp_arr = (array) $y_arr_data[$i];
         //--
         $this->x[$i] = (string) $tmp_arr['x'];
         // label
         $this->y[$i] = (double) $tmp_arr['y'];
         // 1st series
         if ($y_display_graph2 !== false) {
             $this->z[$i] = (double) $tmp_arr['z'];
             // 2nd series
         }
         //end if
         if ($y_display_graph_depths !== false) {
             $this->w[$i] = (int) $tmp_arr['w'];
             // buble size
         }
         //end if
         $this->v[$i] = (string) $tmp_arr['v'];
         // custom color
         //--
     }
     //end for
     //--
 }
 /**
  * Send Email Mime Message from custom MailBox to a destination
  *
  * @param ARRAY			$y_server_settings	arr = [ server_name, server_port, server_sslmode, server_auth_user, server_auth_pass, send_from_addr, send_from_name, smtp_mxdomain ]
  * @param ENUM			$y_mode				'send' = do send | 'send-return' = do send + return | 'return' = return mime formated mail
  * @param STRING 		$to					To:
  * @param STRING 		$cc					Cc: | empty
  * @param STRING 		$subj				Subject:
  * @param STRING 		$message			Body/Message:
  * @param TRUE/FALSE 	$is_html			* Format: Html or Text/Plain
  * @param ARRAY 		$attachments		* $attachments = array('file1.txt'=>'This is the file 1 content', ...);
  * @param ENUM			$charset			* charset
  * @param ENUM			$priority			* 1=High ; 3=Normal ; 5=Low
  * @param STRING 		$inreplyto			'' | the ID of message that is replying to
  * @return ARRAY							OPERATION RESULT, ERROR, MIME MESSAGE
  */
 public static function send_extended_email($y_server_settings, $y_mode, $to, $cc, $subj, $message, $is_html, $attachments, $charset, $priority, $inreplyto, $bcc = '', $replytoaddr = '')
 {
     //-- SMTP Hello
     $server_helo = trim($y_server_settings['smtp_mxdomain']);
     //-- SMTP connection vars
     $server_name = trim($y_server_settings['server_name']);
     $server_port = trim($y_server_settings['server_port']);
     $server_sslmode = trim($y_server_settings['server_sslmode']);
     $server_user = trim($y_server_settings['server_auth_user']);
     $server_pass = trim($y_server_settings['server_auth_pass']);
     //-- SEND FROM
     $send_from_addr = trim($y_server_settings['send_from_addr']);
     $send_from_name = trim($y_server_settings['send_from_name']);
     //--
     //-- mail send class init
     $mail = new SmartMailerSend();
     $mail->usealways_b64 = true;
     //--
     if ((string) $server_name == '@mail') {
         //--
         if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') {
             SmartFrameworkRegistry::setDebugMsg('mail', 'SEND', 'Send eMail Method Selected: [MAIL]');
         }
         //end if
         //-- mail method
         $mail->method = 'mail';
         //--
     } elseif (strlen($server_name) > 0) {
         //--
         if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') {
             SmartFrameworkRegistry::setDebugMsg('mail', 'SEND', 'Send eMail Method Selected: [SMTP]');
         }
         //end if
         //-- smtp server method
         $mail->method = 'smtp';
         $mail->smtp_timeout = '30';
         //--
         $mail->smtp_helo = $server_helo;
         $mail->smtp_server = $server_name;
         $mail->smtp_port = $server_port;
         $mail->smtp_ssl = $server_sslmode;
         //--
         if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') {
             $mail->debuglevel = 1;
             // default is 1
         } else {
             $mail->debuglevel = 0;
             // no debug
         }
         //end if else
         //--
         if ((string) $server_user == '' or (string) $server_pass == '') {
             $mail->smtp_login = false;
         } else {
             $mail->smtp_login = true;
             $mail->smtp_user = $server_user;
             $mail->smtp_password = $server_pass;
         }
         //end if
         //--
     } else {
         //--
         if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') {
             SmartFrameworkRegistry::setDebugMsg('mail', 'SEND', 'Send eMail Method Selected: [NONE] !!!');
         }
         //end if
         //--
         $mail->method = 'skip';
         //--
     }
     //end if else
     //--
     //-- charset
     if ((string) $charset == '') {
         $charset = 'UTF-8';
         // default
     }
     //end if
     //--
     $mail->charset = (string) $charset;
     //--
     //--
     if ((string) $mail->charset != 'UTF-8') {
         // in this case (ISO-88591 / ISO-8859-2) we deaccent the things for maximum compatibility
         $send_from_name = SmartUnicode::deaccent_str($send_from_name);
         $subj = SmartUnicode::deaccent_str($subj);
         $message = SmartUnicode::deaccent_str($message);
     }
     //end if
     //--
     //--
     $tmp_explode_arr = (array) explode('@', (string) $send_from_addr);
     $tmp_name = trim($tmp_explode_arr[0]);
     // not used
     $tmp_domain = trim($tmp_explode_arr[1]);
     // used for message ID
     //--
     $tmp_my_uid = getmyuid();
     $tmp_my_gid = getmygid();
     //--
     //-- Extra Mail Headers
     $mail->headers = '';
     //-- Errors Reporting Header
     $mail->headers .= 'Errors-To: ' . $send_from_addr . "\r\n";
     //-- In-Reply-To Header
     if ((string) $inreplyto != '') {
         $mail->headers .= 'In-Reply-To: ' . $inreplyto . "\r\n";
     }
     //end if else
     //-- Reply-To Header
     if ((string) $replytoaddr != '') {
         $mail->headers .= 'Reply-To: ' . $replytoaddr . "\r\n";
     }
     //end if
     //-- antiSPAM Header
     $mail->headers .= 'X-AntiAbuse: This header was added to track abuse, please include it with any abuse report' . "\r\n";
     $mail->headers .= 'X-AntiAbuse: Primary Hostname - ' . $server_helo . "\r\n";
     $mail->headers .= 'X-AntiAbuse: Original Domain - ' . $server_helo . "\r\n";
     $mail->headers .= 'X-AntiAbuse: Originator/Caller UID/GID - [48880 48885] / [' . $tmp_my_uid . ' ' . $tmp_my_gid . ']' . "\r\n";
     $mail->headers .= 'X-AntiAbuse: Sender Address Domain - ' . $tmp_domain . "\r\n";
     //--
     //--
     $mail->priority = $priority;
     // high=1 | low=5 | normal=3
     //--
     //-- from
     $mail->from_return = $send_from_addr;
     $mail->from = $send_from_addr;
     $mail->namefrom = $send_from_name;
     //--
     //-- subject
     $mail->subject = $subj;
     //--
     //-- if message is html, include CID imgs as attachments
     if ((string) $y_mode != 'return' and $is_html) {
         //-- init
         $arr_links = array();
         //-- embedd all images
         $htmlparser = new SmartHtmlParser($message);
         $htmlparser->get_clean_html();
         // to be tested ...
         $arr_links = $htmlparser->get_tags('img');
         $htmlparser = '';
         unset($htmlparser);
         //--
         $chk_duplicates_arr = array();
         $uniq_id = 0;
         //--
         for ($i = 0; $i < Smart::array_size($arr_links); $i++) {
             //--
             $tmp_original_img_link = trim($arr_links[$i][src]);
             // trim any possible spaces
             //-- reverse the &amp; back to & (generated from JavaScript) ...
             $tmp_imglink = str_replace('&amp;', '&', (string) $tmp_original_img_link);
             //--
             $tmp_cid = 'img_' . sha1('SmartFramework eMail-Utils // CID Embedd // ' . '@' . $tmp_imglink . '#');
             // this should not vary by $i or others because if duplicate images are detected only the first is attached
             //--
             if (strlen($chk_duplicates_arr[$tmp_cid]) <= 0) {
                 // avoid browse twice the same image
                 //--
                 $tmp_original_lnk = (string) $tmp_imglink;
                 $tmp_eval_link = (string) $tmp_imglink;
                 $tmp_allow_credentials = 'no';
                 if (substr($tmp_original_lnk, 0, 10) == 'admin.php?') {
                     $tmp_original_lnk = (string) SmartUtils::get_server_current_url() . $tmp_imglink;
                     $tmp_allow_credentials = 'yes';
                     // in the case we have embedded pictures generated by admin.php who always need authentication to work, we have to send credentials too
                     $tmp_eval_link = '';
                     // we clear to re-eval
                 } elseif (SmartUnicode::sub_str($tmp_original_lnk, 0, SmartUnicode::str_len(SmartUtils::get_server_current_url() . 'admin.php?')) == SmartUtils::get_server_current_url() . 'admin.php?' and (substr($tmp_original_lnk, 0, 7) == 'http://' or substr($tmp_original_lnk, 0, 8) == 'https://')) {
                     $tmp_allow_credentials = 'yes';
                     // in the case we have embedded pictures generated by admin.php who always need authentication to work, we have to send credentials too
                     $tmp_eval_link = '';
                     // we clear to re-eval
                 } elseif (substr($tmp_original_lnk, 0, 10) == 'index.php?' or substr($tmp_original_lnk, 0, 1) == '?') {
                     $tmp_original_lnk = (string) SmartUtils::get_server_current_url() . $tmp_imglink;
                     $tmp_eval_link = '';
                     // we clear to re-eval
                 } elseif (SmartUnicode::sub_str($tmp_original_lnk, 0, SmartUnicode::str_len(SmartUtils::get_server_current_url() . 'index.php?')) == SmartUtils::get_server_current_url() . 'index.php?' and (substr($tmp_original_lnk, 0, 7) == 'http://' or substr($tmp_original_lnk, 0, 8) == 'https://')) {
                     $tmp_eval_link = '';
                     // we clear to re-eval
                 } elseif (SmartUnicode::sub_str($tmp_original_lnk, 0, SmartUnicode::str_len(SmartUtils::get_server_current_url() . '?')) == SmartUtils::get_server_current_url() . '?' and (substr($tmp_original_lnk, 0, 7) == 'http://' or substr($tmp_original_lnk, 0, 8) == 'https://')) {
                     $tmp_eval_link = '';
                     // we clear to re-eval
                 }
                 //end if
                 //--
                 $tmp_browse_arr = array();
                 $tmp_browse_arr = SmartUtils::load_url_or_file($tmp_original_lnk, SMART_FRAMEWORK_NETSOCKET_TIMEOUT, 'GET', '', '', '', $tmp_allow_credentials);
                 // [OK]
                 //Smart::log_notice(print_r($tmp_browse_arr,1));
                 //--
                 $guess_arr = array();
                 $guess_arr = SmartUtils::guess_image_extension_by_url_head($tmp_browse_arr['headers']);
                 $tmp_img_ext = (string) $guess_arr['extension'];
                 $tmp_where_we_guess = (string) $guess_arr['where-was-detected'];
                 //Smart::log_notice('Guess Ext by URL Head: '.$tmp_browse_arr['headers']."\n".'### '.print_r($guess_arr,1)."\n".'#');
                 if ((string) $tmp_img_ext == '') {
                     $tmp_img_ext = SmartUtils::guess_image_extension_by_first_bytes(substr($tmp_browse_arr['content'], 0, 256));
                     if ((string) $tmp_img_ext != '') {
                         $tmp_where_we_guess = ' First Bytes ...';
                     }
                     //end if
                 }
                 //end if
                 //Smart::log_notice('Guess Ext by First Bytes: '.$tmp_img_ext."\n".'#');
                 if ((string) $tmp_eval_link == '') {
                     $tmp_eval_link = 'file' . $tmp_img_ext;
                 }
                 //end if
                 //--
                 $tmp_fcontent = '';
                 if ((string) $tmp_browse_arr['result'] == '1' and (string) $tmp_browse_arr['code'] == '200') {
                     if ((string) $tmp_img_ext == '' or (string) $tmp_img_ext == '.png' or (string) $tmp_img_ext == '.gif' or (string) $tmp_img_ext == '.jpg') {
                         $tmp_fcontent = (string) $tmp_browse_arr['content'];
                     }
                     //end if
                 }
                 //end if else
                 //--
                 if (strlen($tmp_fcontent) > 0) {
                     //--
                     $tmp_arr_fmime = array();
                     $tmp_arr_fmime = SmartFileSysUtils::mime_eval($tmp_eval_link);
                     //--
                     $tmp_fmime = (string) $tmp_arr_fmime[0];
                     if ((string) $tmp_fmime == '' or (string) $tmp_fmime == 'application/octet-stream') {
                         $tmp_fmime = 'image';
                         // in the case of CIDS we already pre-validated the images
                     }
                     //end if
                     $tmp_fname = 'cid_' . $uniq_id . '__' . $tmp_cid . $tmp_img_ext;
                     //--
                     $mail->add_attachment($tmp_fcontent, $tmp_fname, $tmp_fmime, 'inline', $tmp_cid . $tmp_img_ext);
                     // attachment
                     $message = str_replace('src="' . $tmp_original_img_link . '"', 'src="cid:' . $tmp_cid . $tmp_img_ext . '"', $message);
                     //--
                     $uniq_id += 1;
                     //--
                 }
                 //end if
                 //--
                 $chk_duplicates_arr[$tmp_cid] = 'embedd';
                 //--
             }
             //end if
             //--
         }
         //end for
         //-- clean
         $chk_duplicates_arr = array();
         $uniq_id = 0;
         $tmp_original_img_link = '';
         $tmp_imglink = '';
         $tmp_cid = '';
         $tmp_browse_arr = array();
         $tmp_fcontent = '';
         $tmp_arr_fmime = array();
         $tmp_fmime = '';
         $tmp_fname = '';
         //--
     }
     //end if
     //--
     //-- message body
     $mail->is_html = $is_html;
     // false | true
     $mail->body = $message;
     //--
     $message = '';
     unset($message);
     //--
     //-- attachments
     if (is_array($attachments)) {
         if (Smart::array_size($attachments) > 0) {
             while (list($key, $val) = each($attachments)) {
                 //--
                 $tmp_arr_fmime = array();
                 $tmp_arr_fmime = SmartFileSysUtils::mime_eval($key);
                 //--
                 $mail->add_attachment($val, $key, (string) $tmp_arr_fmime[0], 'attachment', '', 'yes');
                 // force as real attachments
                 //--
             }
             //end while
         }
         //end if
     }
     //end if
     //--
     //--
     switch ((string) $y_mode) {
         case 'return':
             //--
             $mail->to = '[::!::]';
             $mail->cc = '';
             //-- only return mime formated message
             $mail->send('no');
             return array('result' => 1, 'error' => '', 'message' => $mail->mime_message);
             //--
             break;
         case 'send-return':
         case 'send':
         default:
             //--
             $out = 0;
             //--
             $arr_to = array();
             if (!is_array($to)) {
                 $arr_to[] = (string) $to;
                 $tmp_send_to = (string) $to;
             } else {
                 $arr_to = (array) $to;
                 if (Smart::array_size($arr_to) > 1) {
                     $tmp_send_to = '[::@::]';
                     // multi message
                 } else {
                     $tmp_send_to = (string) $arr_to[0];
                 }
                 //end if else
             }
             //end if else
             //--
             $tmp_send_log = '';
             $tmp_send_log .= '-----------------------------------------------------------------------' . "\n";
             $tmp_send_log .= 'Smart / eMail Send Log :: ' . $send_from_addr . ' [' . $send_from_name . ']' . "\n";
             $tmp_send_log .= $server_sslmode . '://' . $server_name . ':' . $server_port . ' # ' . $server_user . ' :: ' . $server_helo . "\n";
             $tmp_send_log .= '-----------------------------------------------------------------------' . "\n";
             //--
             $counter_sent = 0;
             for ($i = 0; $i < Smart::array_size($arr_to); $i++) {
                 //--
                 $arr_to[$i] = trim($arr_to[$i]);
                 //--
                 if (strlen($arr_to[$i]) > 0) {
                     //--
                     $mail->to = (string) $arr_to[$i];
                     //--
                     $mail->cc = $cc;
                     // can be string or array
                     //--
                     $mail->bcc = (string) $bcc;
                     //--
                     $tmp_send_log .= '#' . ($i + 1) . '. To: \'' . $arr_to[$i] . '\' :: ' . date('Y-m-d H:i:s O');
                     //-- real send
                     if ((string) $mail->method == 'mail' or (string) $mail->method == 'smtp') {
                         $err = $mail->send('yes');
                         if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') {
                             SmartFrameworkRegistry::setDebugMsg('mail', 'SEND', 'Send eMail Log #' . ($i + 1) . ': ' . $mail->log);
                         }
                         //end if
                     } else {
                         $err = 'WARNING: SMTP Server or Mail Method IS NOT SET in CONFIG. Send eMail - Operation ABORTED !';
                     }
                     //end if else
                     //--
                     if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') {
                         SmartFrameworkRegistry::setDebugMsg('mail', 'SEND', '========== SEND TO: ' . $arr_to[$i] . ' ==========' . "\n" . 'ERRORS: ' . $err . "\n" . '==========' . "\n" . $mail->log . "\n" . '========== # ==========');
                     }
                     //end if
                     //--
                     if (strlen($err) > 0) {
                         $tmp_send_log .= ' :: ERROR:' . "\n" . $arr_to[$i] . "\n" . $err . "\n";
                     } else {
                         $counter_sent += 1;
                         $tmp_send_log .= ' :: OK' . "\n";
                     }
                     //end if else
                     //--
                     if ($i > 10000) {
                         break;
                         // hard limit
                     }
                     //end if
                     //--
                 }
                 //end if
                 //--
             }
             //end for
             //--
             if ($counter_sent > 0) {
                 $out = 1;
             }
             //end if
             //--
             $tmp_send_log .= '-----------------------------------------------------------------------' . "\n\n";
             if ((string) SMART_FRAMEWORK_DEBUG_MODE == 'yes') {
                 SmartFrameworkRegistry::setDebugMsg('mail', 'SEND', 'Send eMail Operations Log: ' . $tmp_send_log);
             }
             //end if
             //--
             if ((string) $y_mode == 'send-return') {
                 $mail->to = $tmp_send_to;
                 if (is_array($cc)) {
                     $mail->cc = (string) implode(', ', $cc);
                 } elseif ((string) $cc != '') {
                     $mail->cc = (string) $cc;
                 }
                 //end if else
                 $mail->add_attachment($tmp_send_log, 'smart-email-send.log', 'text/plain', 'inline');
                 $mail->send('no');
                 return array('result' => $out, 'error' => $err, 'log' => $tmp_send_log, 'message' => $mail->mime_message);
             } else {
                 return array('result' => $out, 'error' => $err, 'log' => $tmp_send_log, 'message' => '');
                 // skip returning the message
             }
             //end if else
             //--
     }
     //end switch
     //--
 }