|
Posted by Stefan Rybacki on 09/21/05 21:10
ralphNOSPAM@primemail.com wrote:
> On Wed, 21 Sep 2005 11:09:29 +0200, Stefan Rybacki
> <stefan.rybacki@gmx.net> wrote:
>
>
>>ralphNOSPAM@primemail.com wrote:
>>
>>>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);
>>>
>>
>>I guess you don't send a MMS you are sending an email. That is different.
>>
>>BTW: for MMS messages have a look here:
>>http://www.openmobilealliance.org/release_program/docs/CopyrightClick.asp?pck=MMS&file=V1_2-20050429-A/OMA-MMS-ENC-V1_2-20050301-A.pdf
>>
>>To your problem with sending emails with attachments:
>>- try to send this email to your normal email application like Thunderbird and have a look
>>whether it works there or not
>>- remember you have to close the last attachment with --$boundary-- not just --$boundary
>>
>>
>>Regards
>>Stefan
>
>
>
> The email addres I'm sending to will be an MMS gateway:
> cellnumber@vzwpix.com which is the gateway for Verizon.
>
> Initially I'm emailing to to my hotmail address just to see if it's
> working and it's nit. I'm getting the attachment but I can't read it.
>
> And yes, I've since added the "--" to the last boundary.
>
Well, did you try to open the file with rb instead with just r?
Stefan
Navigation:
[Reply to this message]
|