class_mcMail.inc.php
1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
class mcMail {
// private static $tab = ' ';
private static $CollectionForMailToAdmin = array();
public static function collectForMailToAdmin($param_to, $param_subject, $param_message, $param_logfile=null) {
if(!array_key_exists($param_to, self::$CollectionForMailToAdmin)) {
self::$CollectionForMailToAdmin[$param_to] = array();
}
self::$CollectionForMailToAdmin[$param_to][] = array(
'subject' => $param_subject,
'message' => $param_message
);
// mail($param_to, $param_subject, $param_message);
}
public static function mail($param_to, $param_subject, $param_message) {
mail($param_to, $param_subject, $param_message);
}
public static function mailToAdmin() {
foreach(self::$CollectionForMailToAdmin as $to => $array_message) {
$subject = false;
if(empty ($_GET)) {
$message = false;
} else {
$message = mcCONST::LINEBREAK.'Url: '.urldecode(http_build_query($_GET)).mcCONST::LINEBREAK;
}
$message .= 'PHP: '. mcCONST::TAB. PHP_VERSION . ' (' . PHP_OS . ')'.mcCONST::LINEBREAK.mcCONST::LINEBREAK;
if(is_array($array_message)) {
foreach($array_message as $var_message) {
if($subject===false) {
$subject = $var_message['subject'].' ';
} else {
$subject .= '.';
}
$message .= mcCONST::LINEBREAK.mcCONST::LINEBREAK
.$var_message['subject'].mcCONST::LINEBREAK
. $var_message['message'].mcCONST::LINEBREAK;
}
self::mail($to, $subject, $message);
}
}
}
}
?>