Ik gebruik een script waarmee de mail die binnenkomt op mijn server word geforward naar een php script.
Dit werkt allemaal prima zoals ik wil, echter is er een probleem.
Mijn mooie script kan niet met html (of mime?) omgaan. Waardoor het terug komende mailtje een enorme troep is:
Is het een oplossing voor ? heb nu al een paar dagen het internet afgespeurd, maar ontdanks dat meer mensen dit probleem hebben heb ik nergends een opslosing gevonden. Graag jullie hulp.
Mijn code:
Dit werkt allemaal prima zoals ik wil, echter is er een probleem.
Mijn mooie script kan niet met html (of mime?) omgaan. Waardoor het terug komende mailtje een enorme troep is:
code:
1
2
3
4
5
6
7
8
9
10
11
12
| [small]mail=2E ------=_NextPart_000_00A9_01C85BE3.37F4E800 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable =3Chtml xmlns=3Av=3D=22urn=3Aschemas-microsoft-com=3Avml=22 xmlns=3Ao=3D=22= urn=3Aschemas-microsoft-com=3Aoffice=3Aoffice=22 xmlns=3Aw=3D=22urn=3Aschem= as-microsoft-com=3Aoffice=3Aword=22 xmlns=3Am=3D=22http=3A//schemas=2Emicro= soft=2Ecom/office/2004/12/omml=22 xmlns=3D=22http=3A//www=2Ew3=2Eorg/TR/REC= -html40=22=3E Enz Enz Enz... [/small] |
Is het een oplossing voor ? heb nu al een paar dagen het internet afgespeurd, maar ontdanks dat meer mensen dit probleem hebben heb ik nergends een opslosing gevonden. Graag jullie hulp.
Mijn code:
code:
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
| #!/usr/local/bin/php -q <?php // read from stdin $fd = fopen("php://stdin", "r"); $email = ""; while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); $lines = explode("\n", $email); $from = ""; $subject = ""; $headers = ""; $message = ""; $splittingheaders = true;for ($i=0; $i < count($lines); $i++) { if ($splittingheaders) { // this is a header` //$headers .= str_replace('"','`',$lines[$i]."\n"); $headers .= $lines[$i]."\n"; // look out for special headers if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {$subject = $matches[1];} if (preg_match("/^To: (.*)/", $lines[$i], $matches)) {$to = $matches[1];} if (preg_match("/^From: (.*)/", $lines[$i], $matches)) {$from = $matches[1];} } else { // not a header, but message $message .= $lines[$i]."\n"; } if (trim($lines[$i])=="") { // empty line, header section has ended $splittingheaders = false; } } $dbh=mysql_connect ("localhost", "*****", "*****"); $sql="INSERT INTO mail (`from`, `subject`, `message`, `headers`) VALUES ('".$from."', '".$subject."', '".$message."', '".$headers."')"; $query = mysql_db_query ("*******", $sql, $dbh); mail ($from,"onderwerp: $subject",$message,"from:$to" ); ?> |
[ Voor 27% gewijzigd door Ruler-Nrg op 21-01-2008 10:20 ]
Dell Precision, T9550, 8gb, 64GB ssd, 1920x1200RGB led.