\r
if(isset($store_mails) && $store_mails) {\r
# Standard-Werte fuer einige Variablen\r
- \r
- if(!isset($store_mails_dir)) $store_mails_dir = '.';\r
- if(!isset($store_mails_prefix)) $store_mails_prefix = '';\r
- \r
+\r
+ if(!isset($store_mails_dir) || $store_mails_dir == '') $store_mails_dir = 'stored_mails';\r
+ if(!isset($store_mails_prefix) || $store_mails_prefix == '') $store_mails_prefix = 'feml_';\r
+\r
# Verzeichnis ggf. anlegen\r
- \r
+\r
if(!is_dir($store_mails_dir)) mkdir($store_mails_dir);\r
\r
# Betreff saeubern\r
$clean_subject = preg_replace('/[^a-z0-9\-_]/i','',$clean_subject);\r
\r
# Eindeutigen Dateinamen der Mail zusammensetzen\r
- \r
+\r
$file_name = $store_mails_dir.'/'.uniqid($store_mails_prefix.$email.'_'.$clean_subject.'_'.strftime('%d%m%Y-%H%M%S',$timestamp));\r
- \r
+\r
# Daten in Datei schreiben\r
- \r
+\r
file_put_contents($file_name,$mailtext);\r
- \r
+\r
# Alte Dateien loeschen\r
- \r
+\r
if(isset($store_mails_max) && $store_mails_max > 0) {\r
$dp = opendir($store_mails_dir);\r
- \r
+\r
while($stored_mail_file = readdir($dp)) {\r
if($stored_mail_file != '.' && $stored_mail_file != '..' && substr($stored_mail_file,0,strlen($store_mails_prefix)) == $store_mails_prefix) {\r
$stored_mail_files[$store_mails_dir.'/'.$stored_mail_file] = filemtime($store_mails_dir.'/'.$stored_mail_file);\r
}\r
}\r
- \r
+\r
closedir($dp);\r
- \r
+\r
arsort($stored_mail_files);\r
- \r
- #print sizeof($stored_mail_files);\r
- \r
- #print_r($stored_mail_files);\r
- \r
+\r
$x = 0;\r
- \r
+\r
foreach(array_keys($stored_mail_files) as $stored_mail_filename) {\r
$x++;\r
- \r
+\r
if($x > $store_mails_max) {\r
unlink($stored_mail_filename);\r
}\r