Posted by ralphNOSPAM on 09/21/05 02:46
I'm trying to write a php script to send a .jpg image to my MMS cell
phone but need some help. I can get the MMS message to arrive at my
phone but when I open up the message there is no image - it's empty!!
Here is my code:
$boundary = '----=' . md5( uniqid ( rand() ) );
$theFile = "radar.jpg";
$message .= "Content-Type: image/pjpeg; name=\"$theFile\"\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "Content-Disposition: inline; filename=\"$theFile\"\n\n";
$path = "/home/public_html/radar.jpg";
$fp = fopen($path, 'r');
do //we loop until there is no data left
{
$data = fread($fp, 1024);
if (strlen($data) == 0) break;
$content .= $data;
} while (true);
$content_encode = chunk_split(base64_encode($content));
$message .= $content_encode . "\n";
$message .= "--" . $boundary . "\n";
$headers = "From: cellphone@mydomain.com\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";
mail($myMMSaddress, "MMS Image Test", $message, $headers);
[Back to original message]
|