Révision 79e5637b htdocs/epack/ryxeo.php
htdocs/epack/ryxeo.php | ||
---|---|---|
9 | 9 |
$headers .= 'Bcc: anet@ryxeo.com' . "\r\n"; |
10 | 10 |
$headers .= 'Content-type: text/plain; charset=utf-8\r\n' . |
11 | 11 |
'X-Mailer: PHP/' . phpversion(); |
12 |
|
|
12 |
|
|
13 |
$subject = encode($subject,'ISO-8859-1'); |
|
13 | 14 |
mail($to,"[anet] " . $subject,$content,$headers); |
14 | 15 |
|
15 | 16 |
} |
16 | 17 |
|
18 |
|
|
19 |
function encode($in_str, $charset) { |
|
20 |
$out_str = $in_str; |
|
21 |
if ($out_str && $charset) { |
|
22 |
|
|
23 |
// define start delimimter, end delimiter and spacer |
|
24 |
$end = "?="; |
|
25 |
$start = "=?" . $charset . "?B?"; |
|
26 |
$spacer = $end . "\r\n " . $start; |
|
27 |
|
|
28 |
// determine length of encoded text within chunks |
|
29 |
// and ensure length is even |
|
30 |
$length = 75 - strlen($start) - strlen($end); |
|
31 |
|
|
32 |
/* |
|
33 |
[EDIT BY danbrown AT php DOT net: The following |
|
34 |
is a bugfix provided by (gardan AT gmx DOT de) |
|
35 |
on 31-MAR-2005 with the following note: |
|
36 |
"This means: $length should not be even, |
|
37 |
but divisible by 4. The reason is that in |
|
38 |
base64-encoding 3 8-bit-chars are represented |
|
39 |
by 4 6-bit-chars. These 4 chars must not be |
|
40 |
split between two encoded words, according |
|
41 |
to RFC-2047. |
|
42 |
*/ |
|
43 |
$length = $length - ($length % 4); |
|
44 |
|
|
45 |
// encode the string and split it into chunks |
|
46 |
// with spacers after each chunk |
|
47 |
$out_str = base64_encode($out_str); |
|
48 |
$out_str = chunk_split($out_str, $length, $spacer); |
|
49 |
|
|
50 |
// remove trailing spacer and |
|
51 |
// add start and end delimiters |
|
52 |
$spacer = preg_quote($spacer); |
|
53 |
$out_str = preg_replace("/" . $spacer . "$/", "", $out_str); |
|
54 |
$out_str = $start . $out_str . $end; |
|
55 |
} |
|
56 |
return $out_str; |
|
57 |
} |
|
58 |
|
|
17 | 59 |
?> |
Formats disponibles : Unified diff