/**
  * Evaluate and return the File MimeType and Disposition by File Extension.
  *
  * @param STRING 		$yfile		the file name (includding file extension) ; Ex: file.ext
  * @return ARRAY 					0 => mime type ; 1 => inline/attachment; filename="file.ext"
  */
 public static function mime_eval($yfile, $ydisposition = '')
 {
     //--
     $yfile = Smart::safe_pathname($yfile);
     //--
     $file = strtolower(self::get_file_name_from_path($yfile));
     // bug fixed: if a full path is sent, try to get just the file name to return
     $extension = strtolower(self::get_file_extension_from_path($yfile));
     // [OK]
     //--
     switch ((string) $extension) {
         //--------------
         case 'txt':
         case 'htm':
         case 'html':
             $type = 'text/html';
             $disp = 'inline';
             //---
             break;
             //--------------
         //--------------
         case 'asc':
         case 'sig':
             $type = 'application/pgp-signature';
             $disp = 'attachment';
             //---
             break;
         case 'curl':
             $type = 'application/vnd.curl';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'js':
             $type = 'application/javascript';
             $disp = 'inline';
             //---
             break;
         case 'json':
             $type = 'application/json';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'xml':
         case 'xsl':
             $type = 'application/xml';
             $disp = 'attachment';
             //---
             break;
         case 'log':
         case 'sql':
             $type = 'text/plain';
             $disp = 'attachment';
             //---
             break;
         case 'csv':
             $type = 'text/csv';
             $disp = 'attachment';
             //---
             break;
         case 'rtf':
             $type = 'application/rtf';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'ai':
         case 'eps':
         case 'ps':
             $type = 'application/postscript';
             $disp = 'attachment';
             //---
             break;
         case 'xfdf':
             $type = 'application/vnd.adobe.xfdf';
             $disp = 'attachment';
             //---
             break;
         case 'pdf':
             $type = 'application/pdf';
             $disp = 'inline';
             // 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'gif':
             $type = 'image/gif';
             $disp = 'inline';
             //---
             break;
         case 'jpg':
         case 'jpe':
         case 'jpeg':
             $type = 'image/jpeg';
             $disp = 'inline';
             //---
             break;
         case 'png':
             $type = 'image/png';
             $disp = 'inline';
             //---
             break;
             //--------------
         //--------------
         case 'tif':
         case 'tiff':
             $type = 'image/tiff';
             $disp = 'attachment';
             //---
             break;
         case 'wmf':
             $type = 'application/x-msmetafile';
             $disp = 'attachment';
             //---
             break;
         case 'bmp':
             $type = 'image/bmp';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'spl':
             $type = 'application/futuresplash';
             $disp = 'inline';
             //---
             break;
         case 'swf':
             $type = 'application/x-shockwave-flash';
             $disp = 'inline';
             //---
             break;
             //--------------
         //--------------
         case 'eml':
             $type = 'message/rfc822';
             $disp = 'attachment';
             //---
             break;
         case 'vcf':
             $type = 'text/x-vcard';
             $disp = 'attachment';
             //---
             break;
         case 'ics':
             $type = 'text/calendar';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'tar':
             $type = 'application/x-tar';
             $disp = 'attachment';
             //---
             break;
         case 'tgz':
         case 'tbz':
             $type = 'application/x-compressed';
             $disp = 'attachment';
             //---
             break;
         case 'z':
             $type = 'application/x-compress';
             $disp = 'attachment';
             //---
             break;
         case 'gz':
             $type = 'application/x-gzip';
             $disp = 'attachment';
             //---
             break;
         case 'bz2':
             $type = 'application/x-bzip2';
             $disp = 'attachment';
             //---
             break;
         case 'xz':
             $type = 'application/x-xz';
             $disp = 'attachment';
             //---
             break;
         case '7z':
         case 'zip':
             $type = 'application/zip';
             $disp = 'attachment';
             //---
             break;
         case 'rar':
             $type = 'application/x-rar-compressed';
             $disp = 'attachment';
             //---
             break;
         case 'sit':
             $type = 'application/x-stuffit';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'doc':
         case 'dot':
             $type = 'application/msword';
             $disp = 'attachment';
             //---
             break;
         case 'xla':
         case 'xlc':
         case 'xlm':
         case 'xls':
         case 'xlt':
         case 'xlw':
             $type = 'application/vnd.ms-excel';
             $disp = 'attachment';
             //---
             break;
         case 'pot':
         case 'pps':
         case 'ppt':
             $type = 'application/vnd.ms-powerpoint';
             $disp = 'attachment';
             //---
             break;
         case 'mdb':
             $type = 'application/x-msaccess';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'mny':
             $type = 'application/x-msmoney';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'wk1':
         case 'wcm':
         case 'wdb':
         case 'wks':
         case 'wps':
             $type = 'application/vnd.ms-works';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'odc':
             $type = 'application/vnd.oasis.opendocument.chart';
             $disp = 'attachment';
             //---
             break;
         case 'otc':
             $type = 'application/vnd.oasis.opendocument.chart-template';
             $disp = 'attachment';
             //---
             break;
         case 'odf':
             $type = 'application/vnd.oasis.opendocument.formula';
             $disp = 'attachment';
             //---
             break;
         case 'otf':
             $type = 'application/vnd.oasis.opendocument.formula-template';
             $disp = 'attachment';
             //---
             break;
         case 'odg':
             $type = 'application/vnd.oasis.opendocument.graphics';
             $disp = 'attachment';
             //---
             break;
         case 'otg':
             $type = 'application/vnd.oasis.opendocument.graphics-template';
             $disp = 'attachment';
             //---
             break;
         case 'odi':
             $type = 'application/vnd.oasis.opendocument.image';
             $disp = 'attachment';
             //---
             break;
         case 'oti':
             $type = 'application/vnd.oasis.opendocument.image-template';
             $disp = 'attachment';
             //---
             break;
         case 'odp':
             $type = 'application/vnd.oasis.opendocument.presentation';
             $disp = 'attachment';
             //---
             break;
         case 'otp':
             $type = 'application/vnd.oasis.opendocument.presentation-template';
             $disp = 'attachment';
             //---
             break;
         case 'ods':
             $type = 'application/vnd.oasis.opendocument.spreadsheet';
             $disp = 'attachment';
             //---
             break;
         case 'ots':
             $type = 'application/vnd.oasis.opendocument.spreadsheet-template';
             $disp = 'attachment';
             //---
             break;
         case 'odt':
             $type = 'application/vnd.oasis.opendocument.text';
             $disp = 'attachment';
             //---
             break;
         case 'otm':
             $type = 'application/vnd.oasis.opendocument.text-master';
             $disp = 'attachment';
             //---
             break;
         case 'ott':
             $type = 'application/vnd.oasis.opendocument.text-template';
             $disp = 'attachment';
             //---
             break;
         case 'oth':
             $type = 'application/vnd.oasis.opendocument.text-web';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'ogg':
             // theora audio
         // theora audio
         case 'oga':
             $type = 'audio/ogg';
             $disp = 'inline';
             break;
         case 'ogv':
             // theora video
             $type = 'video/ogg';
             $disp = 'inline';
             break;
         case 'webm':
             // google vp8
             $type = 'video/webm';
             $disp = 'inline';
             break;
             //--------------
         //--------------
         case 'mpeg':
         case 'mpg':
         case 'mpe':
         case 'mpv':
         case 'mp4':
             $type = 'video/mpeg';
             $disp = 'attachment';
             //---
             break;
         case 'mpga':
         case 'mp2':
         case 'mp3':
             $type = 'audio/mpeg';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'qt':
         case 'mov':
             $type = 'video/quicktime';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'rm':
             $type = 'application/vnd.rn-realmedia';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'avi':
             $type = 'video/x-msvideo';
             $disp = 'attachment';
             //---
             break;
         case 'wm':
         case 'wmv':
         case 'wmx':
         case 'wvx':
             $type = 'video/x-ms-' . $extension;
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         case 'exe':
         case 'msi':
         case 'dll':
         case 'com':
         case 'bat':
         case 'cmd':
             $type = 'application/x-msdownload';
             $disp = 'attachment';
             //---
             break;
             //--------------
         //--------------
         default:
             $type = 'application/octet-stream';
             $disp = 'attachment';
             //--------------
     }
     //end switch
     //--
     switch ((string) $ydisposition) {
         case 'inline':
             $disp = 'inline';
             // rewrite display mode
             break;
         case 'attachment':
             $disp = 'attachment';
             // rewrite display mode
             break;
         default:
             // nothing
     }
     //end switch
     //--
     return array($type, $disp . '; filename="' . Smart::safe_validname($file) . '"');
     //--
 }
 /**
  * Get the ODS Document FileName Header Data
  *
  * @param STRING 	$y_filename		:: The ODS Document file name: default is: file.ods
  * @param ENUM 		$y_disp 		:: The content disposition, default is: inline ; can be also: attachment
  *
  * @return STRING		'attachment; filename="somedoc.ods"' or 'inline; filename="somedoc.ods"'
  *
  */
 public function ODS_Disposition_Header($y_filename = 'file.ods', $y_disp = 'attachment')
 {
     //--
     switch ((string) $y_disp) {
         case 'inline':
             $y_disp = 'inline';
             break;
         case 'attachment':
         default:
             $y_disp = 'attachment';
     }
     //end switch
     //--
     return (string) $y_disp . '; filename="' . Smart::safe_validname($y_filename) . '"';
     //--
 }
示例#3
0
 /**
  * Load/Save a cache file from Memory or from a URL
  *
  * @param STRING 	$y_cache_file_extension		:: File Extension (example: '.ext')
  * @param STRING 	$y_cache_prefix				:: prefix dir (at least 3 chars) ended by slash (Example: 'prefix/')
  * @param STRING 	$y_load_url					:: URL to Load (Ex: http(s)://some/test.txt ; memory://some.unique.key)
  * @param STRING	$y_content					:: just for memory:// ; contents of the file to be saved into cache - [set] mode ; if this is empty will just get
  * @param INT 		$y_cache_expire				:: 0=never ; (>0)=seconds
  * @param ENUM 		$y_encrypted				:: yes/no to encrypt the file content
  * @return MIXED								:: cached contents
  */
 public static function load_cached_content($y_cache_file_extension, $y_cache_prefix, $y_load_url, $y_content = '', $y_cache_expire = 0, $y_encrypted = 'no')
 {
     // v.150209
     //--
     $y_load_url = (string) $y_load_url;
     //--
     if ((string) $y_load_url == '') {
         Smart::log_warning('Utils // Load From Cache ... Empty URL ...');
         return '';
     }
     //end if
     //--
     //--
     $y_cache_file_extension = Smart::safe_validname($y_cache_file_extension);
     //--
     $y_cache_expire = Smart::format_number_int($y_cache_expire, '+');
     //--
     $y_cache_prefix = (string) $y_cache_prefix;
     //--
     if (strlen($y_cache_prefix) >= 3 and strlen($y_cache_prefix) <= 64) {
         //--
         $y_cache_prefix = SmartFileSysUtils::add_dir_last_slash($y_cache_prefix);
         // fix trailing slash
         //--
     } else {
         //--
         $y_cache_prefix = 'default/';
         //--
     }
     //end if
     //--
     //--
     $unique_id = (string) SmartHashCrypto::sha1('@@::SmartFramework::Content::Cache@@' . $y_load_url);
     //--
     $dir = 'tmp/cache/' . $y_cache_prefix . SmartFileSysUtils::prefixed_sha1_path($unique_id);
     SmartFileSysUtils::raise_error_if_unsafe_path($dir);
     //--
     $file = (string) $dir . $unique_id . $y_cache_file_extension;
     SmartFileSysUtils::raise_error_if_unsafe_path($file);
     //--
     //--
     if (!is_dir($dir)) {
         SmartFileSystem::dir_recursive_create($dir);
     }
     // end if
     //--
     $protect_file = $dir . 'index.html';
     if (!is_file($protect_file)) {
         SmartFileSystem::write($protect_file, '');
     }
     //end if
     //--
     //-- will go through this only if cache expired or no cache
     if (!is_file($file) or is_file($file) and $y_cache_expire > 0 and @filemtime($file) + $y_cache_expire < time()) {
         //-- read
         if (substr($y_load_url, 0, 9) == 'memory://' and (string) $y_content != '') {
             //-- set the content from memory
             $tmp_content = (string) $y_content;
             $tmp_result = '1';
             $tmp_code = '200';
             //--
         } elseif (substr($y_load_url, 0, 9) != 'memory://') {
             //--
             $arr = self::load_url_or_file($y_load_url);
             // [OK]
             $tmp_result = $arr['result'];
             $tmp_code = $arr['code'];
             $tmp_content = $arr['content'];
             $arr = array();
             //--
         }
         //end if else
         //-- if required, apply encryption
         if ((string) $y_encrypted == 'yes') {
             //--
             $tmp_content = self::crypto_blowfish_encrypt($tmp_content);
             //--
         }
         //end if
         //-- write to cache
         if ((string) $tmp_result == '1' and (string) $tmp_code == '200') {
             //--
             SmartFileSystem::write($file, $tmp_content);
             // save file to cache (safe write is controlled via locks)
             //--
         }
         //end if
         //--
         $tmp_content = '';
         //--
     }
     //end if
     //--
     //-- get from cache
     $out = SmartFileSystem::read($file);
     //--
     if ((string) $y_encrypted == 'yes') {
         $out = self::crypto_blowfish_decrypt($out);
     }
     //end if
     //--
     //--
     return $out;
     //--
 }
示例#4
0
 public function disposition_header($y_filename = 'gfx-chart')
 {
     //--
     return (string) 'inline; filename="' . Smart::safe_validname($y_filename . '-' . $this->type . '-' . time() . '.' . $this->format) . '"';
     //--
 }
 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;
     //--
 }
 /**
  * Send Email Mime Message from SmartFramework to a destination
  *
  * @param STRING 		$to				To:
  * @param STRING 		$bcc			'' | BCc:
  * @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=Low ; 3=Normal ; 5=High
  * @param STRING		$logsend_dir	'' | path/to/log/messages
  * @param STRING		$cc				'' | Cc:
  * @param STRING		$inreplyto		'' | In-Reply-To:
  * @return TRUE/FALSE	OPERATION RESULT [0 / 1]
  */
 public static function send_email($to, $bcc, $subj, $message, $is_html, $attachments = array(), $charset = 'UTF-8', $priority = '3', $logsend_dir = '', $cc = '', $inreplyto = '', $replytoaddr = '')
 {
     //--
     global $configs;
     //-- SMTP connection vars
     $server_settings = array('server_name' => $configs['sendmail']['server-host'], 'server_port' => $configs['sendmail']['server-port'], 'server_sslmode' => $configs['sendmail']['server-ssl'], 'server_auth_user' => $configs['sendmail']['auth-user'], 'server_auth_pass' => $configs['sendmail']['auth-password'], 'send_from_addr' => $configs['sendmail']['from-address'], 'send_from_name' => $configs['sendmail']['from-name'], 'smtp_mxdomain' => $configs['sendmail']['server-mx-domain']);
     //--
     $stmp_y = date('Y');
     $stmp_m = date('m');
     $stmp_d = date('d');
     $stmp_time = date('His');
     //--
     $logsend_dir = trim($logsend_dir);
     //--
     if (strlen($logsend_dir) > 0) {
         //--
         $logsend_dir = SmartFileSysUtils::add_dir_last_slash($logsend_dir);
         // if the last / is not present will add it
         $logsend_dir .= $stmp_y . '/' . $stmp_y . '-' . $stmp_m . '/' . $stmp_y . '-' . $stmp_m . '-' . $stmp_d . '/';
         //--
         SmartFileSystem::dir_recursive_create($logsend_dir);
         //--
         $tmp_send_mode = 'send-return';
         //--
     } else {
         //--
         $tmp_send_mode = 'send';
         //--
     }
     //end if else
     //--
     $arr_send_result = self::send_extended_email($server_settings, $tmp_send_mode, $to, $cc, $subj, $message, $is_html, $attachments, $charset, $priority, $inreplyto, $bcc, $replytoaddr);
     //--
     if (strlen($logsend_dir) > 0) {
         if (is_dir($logsend_dir)) {
             if (is_array($to)) {
                 $mark_to = '@multi@';
             } else {
                 $mark_to = (string) $to;
             }
             //end if else
             SmartFileSystem::write($logsend_dir . $stmp_y . $stmp_m . $stmp_d . '_' . $stmp_time . '__' . Smart::safe_validname($mark_to) . '__' . sha1($to . $cc . $subj . $message) . '.eml', $arr_send_result['message']);
         }
         //end if
     }
     //end if
     //--
     return $arr_send_result['result'];
     // only return the result as 0 for error and 1 for success
     //--
 }