# geschrieben wurde.\r
#\r
# Autor: Patrick Canterino <patrick@patshaping.de>\r
-# Letzte Aenderung: 09.01.2012\r
+# Letzte Aenderung: 05.02.2012\r
#\r
# Copyright (C) 2002-2012 Patrick Canterino\r
#\r
$mailto = semicolon_split($mailto);\r
\r
for($x=0;$x<count($mailto);$x++) {\r
- mail($mailto[$x],$encoded_subject,$mailtext,$header) or die($err_send_error);\r
+ mail($mailto[$x],$encoded_subject,$mailtext,$header) or show_fatal($err_send_error);\r
}\r
\r
# Mails auf Festplatte speichern\r
\r
if(isset($store_mails) && $store_mails) {\r
# Standard-Werte fuer einige Variablen\r
- \r
- if(!isset($store_mails_dir)) $store_mails_dir = 'stored_mails';\r
- if(!isset($store_mails_prefix)) $store_mails_prefix = 'feml_';\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
- file_put_contents($file_name,$mailtext);\r
- \r
+\r
+ file_put_contents($file_name,$mailtext) or show_fatal($err_store_error);\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