Question : How to code a MMS with img attachments?

We have a function which creates an MMS and sends it to a gateway (Ericsson IPX) for delivery. Everything works like a charm, except the fact that images wont show on certain cellphones. This is not some fance MMS but just an image and some text. I've tried to to it with more or less simple SMIL-body, but it just won't work.

I've googled half the net for full coding examples of what works of which phone, what is fail-proof and what is not, but with poor results. I need an example of a MMS, complete with headers and multipart mime attachments. It looks very close to an email, but even when adding email parameters it wont work. Does anyone have access to a raw MMS sent from a phone to another where I could check the structure and just play follow-john?

The following code is a mix between sample files from IPX and what I've found online, and it works, for some phones.
Code Snippet:
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:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
POST [XXX] HTTP/1.1
Host: europe.ipx.com
Content-Type: multipart/related; type="text/xml"; boundary="----=_037e2e9a2f4e80683dd5c5ec875fb0ce"
Authorization: Basic [XXX]
Content-Length: 18800
Cache-Control: no-cache 
Pragma: no-cache 
Accept: text/html, image/gif, image/jpg, *; q=.2, */*; q=.2
 
Connection: keep-alive
------=_037e2e9a2f4e80683dd5c5ec875fb0ce
Content-Type: text/xml; charset=utf-8
 

    
        [XXX]_20090605211315
    
    
        
            6.5.0
            
                [XXX]
                
                    [XXX]
                
            
            
                
                    46733[XXX]
                
            
            [XXX]
            1
            MMS Subject
            
        
 
    

------=_037e2e9a2f4e80683dd5c5ec875fb0ce
Content-Type: application/vnd.wap.multipart.related; boundary="----=_45435153f79e2b654ebf607c4d65e15e"
Content-Id: 
 
------=_45435153f79e2b654ebf607c4d65e15e
Content-Type: application/smil
Content-ID: 
 








 














 
------=_45435153f79e2b654ebf607c4d65e15e
Content-Type: text/plain; charset=utf-8; name=text_1.txt
Content-ID: 
 
Hello!
This is the first text-block.
------=_45435153f79e2b654ebf607c4d65e15e
Content-Type: text/plain; charset=utf-8; name=text_2.txt
Content-ID: 
 
And this is the second text-block.
------=_45435153f79e2b654ebf607c4d65e15e
Content-Type: image/jpg; name=pin_image.jpg
Content-Transfer-Encoding: base64
Content-ID: 
 
/* base64-image stripped out from code due to its length */
------=_45435153f79e2b654ebf607c4d65e15e--
 
------=_037e2e9a2f4e80683dd5c5ec875fb0ce--Array

Answer : How to code a MMS with img attachments?

Since I got no replies to this post, I managed to get it to work by doing crazy amount of tests. My phone bill will be huge but at least it works now. We already started to advertise the service so I needed it to work ASAP.

The problem seems to have been several headers in the attachment headers. Added Content-location and Name under Content-type, plus Content-transfer-encoding:7bit on all text and smil attachments.

Now all mobile phones (that we've tested this on: SonyEricsson, Nokia, iPhone and Samsung) both recieve the MMS and show the image without error. Great.

The complete working request code is attached below. With some elements filtered out with [XXX] for security reasons.
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:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
POST [XXX] HTTP/1.1
Host: europe.ipx.com
Content-Type: multipart/related; type="text/xml"; boundary="----=_BOUND/att+23149930e9105b228e9d="
Authorization: Basic [XXX]
Content-Length: 19137
Cache-Control: no-cache 
Pragma: no-cache 
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
 
------=_BOUND/att+23149930e9105b228e9d=
Content-Type: text/xml; charset=utf-8
 

    
        [XXX]
    
    
        
            6.5.0
            
                [XXX]
                
                    [XXX]
                
            
            
                
                    46733[XXX]
                
            
            tariffClass=SEK0;
            1
            [XXX]
            
        
    

 
------=_BOUND/att+23149930e9105b228e9d=
Content-Type: multipart/mixed; boundary="----=_BOUND/mms+8b49a068bc151282c4f7="
Content-ID: 
 
------=_BOUND/mms+8b49a068bc151282c4f7=
Content-type:application/smil;Charset=UTF-8;Name="mms.smil";Filename="mms.smil"
Content-transfer-encoding:7bit
Content-ID: 
 
















------=_BOUND/mms+8b49a068bc151282c4f7=
Content-type:text/plain;Charset=UTF-8;Name="smil1.txt"
Content-location: smil1.txt
Content-transfer-encoding:7bit
Content-ID: 
 
Hi!
Lets hope that the image is above this text!
------=_BOUND/mms+8b49a068bc151282c4f7=
Content-type:text/plain;Charset=UTF-8;Name="smil2.txt"
Content-location: smil2.txt
Content-transfer-encoding:7bit
Content-ID: 
 
This is the text displayed on page 2 of the MMS.
------=_BOUND/mms+8b49a068bc151282c4f7=
Content-type:image/jpeg;Name="BRIS Pin.jpg"
Content-location: Attached%20Image.jpg
Content-Transfer-Encoding:base64
Content-ID: 
 
/* base64-image stripped out from code due to its length */
------=_BOUND/mms+8b49a068bc151282c4f7=--
 
------=_BOUND/att+23149930e9105b228e9d=--
Random Solutions  
 
programming4us programming4us