[thelist] Incoming Mail and PHP

Kasimir K evolt at kasimir-k.fi
Wed Aug 11 10:29:45 CDT 2004


> Subject: test 0811s
> Content-Type: multipart/mixed;
>   boundary=

> Any ideas what is happening here, and why, and how to get over it? 
> ======================================================================

> do
> {
> 	$data = fread(STDIN, 8192);
> 	$email .= $data;
> 	if (strlen($data) == 0)
> 	{
> 		break;
> 	}
> 	mysql_query('
> 		UPDATE test
> 		SET message = "'.$email.'"
> 		WHERE id = "'.$id.'"
> 	');
> }
> while(true);

Solved it! I was concentrating on the fread, but actually the problem 
was with mysql_query... as soon as $email had a quote, as in line
  boundary="------------000709040008000406020907"
the script failed.

SET message = "'.mysql_escape_string($email).'"

fixed the problem. Plain text emails didn't have the boundary, so they 
behaved nicely.

.k


More information about the thelist mailing list