Hello:
I am trying to pipe emails to this script that i have been trying to write. Everything works fine except one thing. When I send emails to the script via outlook i dont get just the body content but i get this...
$Body =
------=_NextPart_000_0017_01C4ECCD.A7AA6770
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
test email
------=_NextPart_000_0017_01C4ECCD.A7AA6770
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2523" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>test email</FONT></DIV></BODY></HTML>
------=_NextPart_000_0017_01C4ECCD.A7AA6770--
if i send emails from hotmail, yahoo, or thunderbird i get what i want.
$Body = testemail
Does anyone know how i can fix this so it just outputs the text and not all the other info that outlook sends?
$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) {
$Headers .= $lines[$i]."\n";
if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {
$Subject = $matches[1];
}
} else {
// not a header, but message
$Body .= $lines[$i]."\n";
}
if (trim($lines[$i])=="") {
// empty line, header section has ended
$splittingheaders = false;
}
}