I am programmatically sending a Content-Type': 'multipart/form-data to an endpoint and my system (Ubuntu) is default on UTF-8.
My question is, which Content-Transfer-Encoding should/do I use?
Here is an example of a form part:
Content-Disposition: form-data; name="to"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: ?
jacob#example.com
Which Content-Transfer-Encoding would be the safest to use?
Another example:
Content-Disposition: form-data; name="message"; filename="message.mime"
Content-Type: message/rfc822; charset=UTF-8
Content-Transfer-Encoding: ?
From: jacob#example.com
To: jacob#example.com
Subject: testing Coreor
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
testing Coreor
I have updated my code to use quoted-printable, so I now send the below.
It works, but do you see any errors, problems or optimizations?
--x.ai/coreor=---14187500275550.5525101518724114
Content-Disposition: form-data; name="to"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
jacob#example.com
--x.ai/coreor=---14187500275550.5525101518724114
Content-Disposition: form-data; name="message"; filename="message.mime"
Content-Type: message/rfc822; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Mailer: x.ai Coreor v1.test
From: =22Jacob=22 <jacob#example.com>
To: jacob#example.com
Subject: testing Coreor via Mailgun
Content-Type: text/plain; charset=3Dutf-8
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
testing Coreor
--x.ai/coreor=---14187500275550.5525101518724114--
I use mimelib for the quoted-printable encoding.
Related
Since latest version of RestSharp, all my post API's are failing because something has been added to the bodies I send.
Looks like a Guid id is generated and is added before and after the body for each call; the issue is it's not accepted by all my API's providers.
FYI, I created 2 identical console apps, one with version "106.12.0", and one with latest version "107.3.0". please see below the result:
Thanks in advance to help me with this
BR
-Vince
Examples:
Working with Version="106.12.0" :
before:
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name="application/xml"
<SMSBoxXMLRequest>
<username>cnoxxxx</username>
<!-- password hidden -->
<command>WEBSEND</command>
<parameters>
<service>VALAIS</service>
<text>Test de Message Sms 1</text>
<test></test>
<receiver>+4177222333444</receiver>
</parameters>
</SMSBoxXMLRequest>
after:
Not Working with Version="107.3.0" :
**--497993c6-3ef7-47fb-b527-403c1eefedf8**
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name="application/xml"
<SMSBoxXMLRequest>
<username>cnoxxxx</username>
<!-- password hidden -->
<command>WEBSEND</command>
<parameters>
<service>VALAIS</service>
<text>Test de Message Sms 1</text>
<test></test>
<receiver>+4177222333444</receiver>
</parameters>
</SMSBoxXMLRequest>
**--497993c6-3ef7-47fb-b527-403c1eefedf8--**
**--3277a8db-bd83-4f3c-af2e-d34efe76fe98**
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name="application/xml"
<SMSBoxXMLRequest>
<username>cnoxxxx</username>
<!-- password hidden -->
<command>WEBSEND</command>
<parameters>
<service>VALAIS</service>
<text>Test de Message Sms 2</text>
<test></test>
<receiver>+4177222333444</receiver>
</parameters>
</SMSBoxXMLRequest>
**--3277a8db-bd83-4f3c-af2e-d34efe76fe98--**
**--5b81fa95-a0b9-4f5c-9242-742734b0241e**
Content-Type: text/plain; charset=utf-8
Content-Disposition: form-data; name="application/xml"
<SMSBoxXMLRequest>
<username>cnoxxxx</username>
<!-- password hidden -->
<command>WEBSEND</command>
<parameters>
<service>VALAIS</service>
<text>Test de Message Sms 3</text>
<test></test>
<receiver>+4177222333444</receiver>
</parameters>
</SMSBoxXMLRequest>
**--5b81fa95-a0b9-4f5c-9242-742734b0241e-**-
I had received some mail message, but I was confused with these headers:
Content-Type: text/plain;
format=flowed;
charset="UTF-8";
reply-type=response
Content-Transfer-Encoding: 8bit
If Content-Type: charset="UTF-8" is already specified, so why we need Content-Transfer-Encoding: 8bit?
Because you can also have:
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64
The charset is independent of the content encoding.
I am sending email using a OSB (11.1.1.6) service.
Some email clients do not pick up the attachments.
We have narrowed down the problem down to MIME Content-Type.
Going through OSB it sets the Content-Type to multipart/related. In order to get it to work (we tested this using ncat) we need to set the Content-Type to multipart/mixed.
I cannot however find any way to force OSB to set it to multipart/mixed.
This message does not display the attachment on some clients:
From: <nothing#example.com>
To: nothing#example.com
Message-ID: <xxx>
Subject: Subject 123
MIME-Version: 1.0
Content-Type: multipart/related; boundary="MIME_Boundary";
start=1389578236803081255-2926c9b7.148d69bfba8.7396
Return-Path: nothing#example.com
--MIME_Boundary
Content-ID: 1389578236803081255-2926c9b7.148d69bfba8.7396
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
<h1>Head</h1>
<p>Paragraph <b>bold</b></p>
--MIME_Boundary
Content-Type: text/plain; name="TEST.txt"
Content-Transfer-Encoding: base64
Content-Description: TEST.txt
Content-Disposition: attachment; filename="TEST.txt"
VGVzdGluZyAxMjM=
--MIME_Boundary--
This message displays the attachment:
From: <nothing#example.com>
To: nothing#example.com
Message-ID: <xxx>
Subject: Subject 123
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="MIME_Boundary";
start=1389578236803081255-2926c9b7.148d69bfba8.7396
Return-Path: nothing#example.com
--MIME_Boundary
Content-ID: 1389578236803081255-2926c9b7.148d69bfba8.7396
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
<h1>Head</h1>
<p>Paragraph <b>bold</b></p>
--MIME_Boundary
Content-Type: text/plain; name="TEST.txt"
Content-Transfer-Encoding: base64
Content-Description: TEST.txt
Content-Disposition: attachment; filename="TEST.txt"
VGVzdGluZyAxMjM=
--MIME_Boundary--
As you can see the only difference is the Content-Type.
So how do I force OSB to set the Content-Type to multipart/mixed ?
You can set the Transport Header Content-Type. I assume you are using the routing to call the BS service which has email configuration. From Proxy, where you are routing, in the request actions, add Communication > Transport Headers. From the drop down, select emails >> Content-Type.
After some communication with Oracle support we were pointed to apply patch 12585136.
This was one of the bugs fixed for OSB 11.1.1.7 (link)
12585136 - The Email transport generates multipart/related emails and not mulitpart/mixed
After we have applied and tested the patch I will update this answer with more feedback.
I am trying to upload video to youtube from iPhone app. But i am getting "Malformed multipart body".
Here is my request format :-
Headers :
Authorization: Bearer ya29.AHES6ZRfVWRgOe78g4eHz8v85yFztU-ea3jEy6d_4mbEkAMVD33_1w
GData-Version: 2
Host: uploads.gdata.youtube.com
X-GData-Key: key=AI39si5TXQBExBk3eT3cn4eCOSKr1GEOJd5_HJ-RjUGPErby1Qn4aOL-HlecdrxZ3Ur7QocO8Di9wHxUdV2fSYTM3mtFCyzl_A
Slug: summer_vacation.mp4
Content-Type: multipart/related; boundary="f93dcbA3"
Request Body:
--f93dcbA3
Content-Type: application/atom+xml; charset=UTF-8
<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:yt="http://gdata.youtube.com/schemas/2007">
<media:group>
<yt:incomplete/>
<media:category
scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Travel
</media:category>
</media:group>
</entry>
--f93dcbA3
Content-Type: video/mp4
Content-Transfer-Encoding: binary
--f93dcbA3--
Please help me.
I think it is because of the extra line after your second boundary (just before the Content-Type: video/mp4 header). Also, be sure to add a line between the Content-Transfer-Encoding: binary header and your binary data.
Take the Google Example as model :
POST /feeds/api/users/default/uploads HTTP/1.1
Host: uploads.gdata.youtube.com
Authorization: Bearer ACCESS_TOKEN
GData-Version: 2
X-GData-Key: key=adf15ee97731bca89da876c...a8dc
Slug: video-test.mp4
Content-Type: multipart/related; boundary="f93dcbA3"
Content-Length: 1941255
Connection: close
--f93dcbA3
Content-Type: application/atom+xml; charset=UTF-8
<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:yt="http://gdata.youtube.com/schemas/2007">
<media:group>
<media:title type="plain">Bad Wedding Toast</media:title>
<media:description type="plain">
I gave a bad toast at my friend's wedding.
</media:description>
<media:category
scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People
</media:category>
<media:keywords>toast, wedding</media:keywords>
</media:group>
</entry>
--f93dcbA3
Content-Type: video/mp4
Content-Transfer-Encoding: binary
<Binary File Data>
--f93dcbA3--
I try to upload an image to my webservice from my iphone application. The webservice is programmed in php. I have to send the image along with a device_id as multipart/form-data.
Something is wrong with my request because the server does not accept my device_id (invalid format). I am 100% positive that the device_id is correct because it works with my other requests.
I think there is something wrong with my request structure because Charles proxy cannot decode the multipart form-data.
Here is my request (sniffed with charles proxy):
POST /api/profile/update HTTP/1.1
Host: THE_URL
User-Agent: SeduceMe/1.0 CFNetwork/548.0.3 Darwin/11.2.0
Content-Length: 6639
Accept: */*
Content-Type: multipart/form-data; boundary=---------------------------255141413922088
Accept-Language: de-de
Accept-Encoding: gzip, deflate
Cookie: PHPSESSID=tlcpnqugcpgs0skh3l2ip9ujh7
Connection: keep-alive
Proxy-Connection: keep-alive
---------------------------255141413922088
Content-Disposition: form-data; name="device_id"
mgs2AHyvfIcSXHSKE+0eHA==
---------------------------255141413922088
Content-Disposition: form-data; name="form[file]"; filename="avatar.jpg"
Content-Type: image/jpeg
RAW_JPEG_DATA
---------------------------255141413922088--
there is a great wrapper to post form/data. it is ASIHTTPRequest
please look at ASIFormData
thanks/