1 |
cvsjoko |
1.1 |
<?php |
2 |
|
|
|
3 |
|
|
/* |
4 |
|
|
----------------------------------- |
5 |
|
|
*** progressive media *** |
6 |
|
|
|
7 |
|
|
pm-dmcdfl.inc.php3 |
8 |
|
|
|
9 |
|
|
Progressive Media: |
10 |
|
|
Dynamic mail creation and |
11 |
|
|
delivery function library. |
12 |
|
|
|
13 |
|
|
22.05.2k - 23.05.2k, pa |
14 |
|
|
----------------------------------- |
15 |
|
|
*/ |
16 |
|
|
|
17 |
|
|
// ----------------------------------- |
18 |
|
|
|
19 |
|
|
$debug = 0; |
20 |
|
|
|
21 |
|
|
// ----------------------------------- |
22 |
|
|
|
23 |
|
|
/* |
24 |
|
|
function Debug($text, $alert) { |
25 |
|
|
|
26 |
|
|
global $debug; |
27 |
|
|
|
28 |
|
|
if (($debug & 1) == 1) { |
29 |
|
|
|
30 |
|
|
echo "\n<p align=\"left\" style=\"font: 10 px Arial; color: #ffffc0; padding: 4 px; margin: 2 px; background-color: "; |
31 |
|
|
|
32 |
|
|
if ($alert) { echo "#800000"; } else { echo "#006000"; } |
33 |
|
|
|
34 |
|
|
echo ";\" width=\"66%\">\n<b>$text</b>\n</p>\n<br>\n\n"; |
35 |
|
|
|
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
if (($debug & 1) == 2) { |
39 |
|
|
|
40 |
|
|
// LOG file schreiben. |
41 |
|
|
|
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
} |
45 |
|
|
*/ |
46 |
|
|
|
47 |
|
|
function MailTo($sender, $reciever, $subject, $body, $ishtml, $extraheaderdata) { |
48 |
|
|
|
49 |
|
|
return mail($reciever, $subject, $body, |
50 |
|
|
"From: $sender\r\nContent-Type: " . ($ishtml ? "text/html" : "text/plain") . |
51 |
|
|
"\r\nContent-Length: " . strlen($body) . "\r\n$extraheaderdata"); |
52 |
|
|
|
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
function SendMail($sender, $reciever, $subject, $text) { |
56 |
|
|
|
57 |
|
|
return MailTo($sender, $reciever, $subject, $text, false, ""); |
58 |
|
|
|
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
function SendParsedMail($sender, $reciever, $subject, $mailtemplatepath, $ishtml, $replace_array) { |
62 |
|
|
|
63 |
|
|
$templatefile = fopen($mailtemplatepath, "r"); |
64 |
|
|
$filecontent = fread($templatefile, filesize($mailtemplatepath)); |
65 |
|
|
fclose($templatefile); |
66 |
|
|
|
67 |
|
|
$tagcount = 0; |
68 |
|
|
|
69 |
|
|
while (isset($replace_array[$tagcount++])) { |
70 |
|
|
|
71 |
|
|
$filecontent = str_replace("<[" . $tagcount . "]>", $replace_array[$tagcount - 1], $filecontent); |
72 |
|
|
|
73 |
|
|
} |
74 |
|
|
|
75 |
|
|
return MailTo($sender, $reciever, $subject, $filecontent, $ishtml, ""); |
76 |
|
|
|
77 |
|
|
} // function SendParsedMail |
78 |
|
|
|
79 |
|
|
?> |