I'm programming an email newsletter with a couple of embedded images. The headers look like:
... (snip)
MIME-Version: 1.0
Content-type: multipart/related;
boundary="xyzzy1220091"
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--xyzzy1220091
Content-type: text/html; charset=iso-8859-1; name="tempE924AAC7.html"
Content-description: html
Content-transfer-encoding: 7bit
Content-disposition: INLINE
(HTML newsletter here)
--xyzzy1220091
Content-type: image/jpeg; name="cabecera.jpg"
Content-description: cabecera
Content-transfer-encoding: base64
Content-disposition: inline; filename="cabecera.jpg";
Content-ID: <cabecera>
This works correctly in Gmail, Hotmail, Apple Mail... everything I tested it on, except Outlook 2010. In it, it will show an empty message and the HTML and JPG files as attachments in separate tabs; if you click on the HTML, it will show you a preview button with a warning about showing previews only from trusted sources.
If I send the newsletter not as a multipart/related attachment, but just as a HTML email:
Content-type: text/html
Content-transfer-encoding: quoted-printable
Then it displays perfectly in Outlook... but of course, then I can't add inline images.
As for the original problem, I solved it by using "multipart/alternative" and not attaching the HTML part as a file
Related
I've upgraded an existing email sending program from Indy 9 to Indy 10. This works fine in our test environment but on a clients site the attachments are appearing in the body of the email. Their SMTP server is adding a footer to the email and adding <html> ... </html> tags around the whole thing, which is causing this issue. The previous version on Indy 9 worked fine for this client.
Here is an example of the email we are sending:
Content-Type: multipart/mixed; boundary="gcJJK3Qk5C6XIV9FEwfRcK=_EH4Oq32hqE"
MIME-Version: 1.0
Date: Thu, 1 Oct 2020 00:02:29 +0100
Message-Id: <20201001000278.SM78660#B-P-S0308-APP1>
This is a multi-part message in MIME format
--gcJJK3Qk5C6XIV9FEwfRcK=_EH4Oq32hqE
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Body text appears here.
--gcJJK3Qk5C6XIV9FEwfRcK=_EH4Oq32hqE
Content-Type: application/octet-stream;
name="PDA Audit.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="PDA Audit.pdf"
JVBERi0xLjINCjEgMCBvYmoNCjw8IC9UeXBlIC9DYXRhbG9nIA0KL1BhZ2VzIDMgMCBSIA0KL1Zp
ZXdlclByZWZlcmVuY2VzIDw8IA0KPj4NCj4+IA0KZW5kb2JqDQo1IDAgb2JqDQo8PCAvVHlwZSAv
<more lines here>
--gcJJK3Qk5C6XIV9FEwfRcK=_EH4Oq32hqE--
Is there anything wrong with this?
I note that the boundary no longer contains the =_NextPart, so I'm wondering if the code on the server has been badly written and is expecting to find this. Has anyone else had a similar issue?
Issue solved. We were allowing Indy to decide on the Content-Type which worked if we only sent an email with an attachment. If a previous email was just text the Content-Type was set to text/plain. When the email with the attachment was then sent Indy thought the Content-Type was already set so did not change it. Setting the Content-Type correctly solved the problem.
Is there a way to send OData batch requests using either ODataQueryBuilder or VDM generated classes?
Example:
Let's say I'm using the Northwind public OData service (https://services.odata.org/V2/Northwind/Northwind.svc/)
Due to network performance I want to query the Customers, Categories and Regions in one only request, like this:
URL: https://services.odata.org/V2/Northwind/Northwind.svc/$batch
--batch_8008-578f-c3c1
Content-Type: application/http
Content-Transfer-Encoding: binary
GET Customers HTTP/1.1
Accept: application/json
Accept-Language: en
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0
--batch_8008-578f-c3c1
Content-Type: application/http
Content-Transfer-Encoding: binary
GET Categories HTTP/1.1
Accept: application/json
Accept-Language: en
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0
--batch_8008-578f-c3c1
Content-Type: application/http
Content-Transfer-Encoding: binary
GET Regions HTTP/1.1
Accept: application/json
Accept-Language: en
DataServiceVersion: 2.0
MaxDataServiceVersion: 2.0
--batch_8008-578f-c3c1--
(I tested this in Postman, it works.)
I have other scenarios where this would be really useful, such as reading several individual entries at once, sending ChangeSets to change several entries in a "transaction", and calling function imports.
This feature is not yet supported but, of course, completely valid. We will update this question once an update regarding this matter is available.
I'm developing an API proxy in Apigee EDGE to expose a Target API in SOAP (XML) to a REST/JSON endpoint with a fairly simple XMLtoJSON and a AssignMessage policy.
Until I just noticed that some characters in the final JSON were displayed as "?" while in the original SOAP (XML) response the same characters were correctly displayed as "รก" for example.
Then I noticed that the response from the Target API endpoint came in as:
Content-Type: text/xml; charset=iso-8859-1
While my intention is to output a properly encoded UTF-8 response as:
Content-Type: application/json; charset=utf-8
So my question is: Is there a way to convert the character encoding from iso-8859-1 to UTF-8 using just standard Policies? without incurring in going to Node, Java, Javascript or Python policies to do this simple character encoding?
You should be able to just set the appropriate encoding in a Content-Type header on the response using the AssignMessage policy... Does that work?
I'm currently working on an application that will send the user a selected coupon via email or MMS. The problem that I am running into is with the display of the MMS when the customer receives it. on Android, the image is being displayed as a video, and on iOS, everything is wrong about the message.
Here's an example of the headers that are being sent:
User-Agent: none
Date: Tue, 5 Mar 2013 10:45:12 -0500
From:
Return-Path:
Subject: =?utf-8?Q?Your_Requested_Coupon?=
To: ###########txt.att.net
Reply-To: "webadministrator#domain.com"
X-Sender: webadministrator#domain.com
X-Mailer: none
X-Priority: 3 (Normal)
Message-ID: <51361308f1651#domain.com>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="B_ATC_51361309002f2"
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ATC_51361309002f2
Content-Type: multipart/alternative; boundary="B_ALT_51361308f3595"
--B_ALT_51361308f3595
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
--B_ALT_51361308f3595
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
--B_ALT_51361308f3595--
--B_ATC_51361309002f2
Content-type: image/jpeg; name="promo3.jpg"
Content-Disposition: attachment;
Content-Transfer-Encoding: base64
....
IMAGE ENCODING HERE
....
--B_ATC_51361309002f2--
And the CI Code:
$this->email->from('webadministrator#domain.com');
$this->email->to('XXXXXXXXXX#PHONE_MESSAGE_CENTER.COM');
$this->email->subject('Your Requested Coupon');
$this->email->message($this->load->view('sms_email', '', TRUE));
$this->email->attach('/path/to/image.jpg'); //I've also tried passing a second param 'inline' to change the Content-Disposition to inline
Does anyone know if it is possible to use the built in email class to accomplish this, or do I need to write specific headers to make picture messaging display properly?
Also is there a proper message format for MMS: text or html?, is there a proper way to attach an image for the iOS to view?
trying to send mms from the web using an email address, example #mms.att.com, will get you blocked by the network eventually. there is not a clean way to get around this problem without support of the network or mms partner. the best solution these days is to just send an sms with a link to a mobile ad on the web.
and by the way, i'd recommend a provider like cdyne or twilio for sms (dont try to send sms via email address either!) you might also try to simply connect a 3g/4g modem and modifying the driver to programmatically shoot sms/mms messages. go at your own risk on that one ..
I need to upload html files to google docs with Google Documents List API, but the server always response an error of "ServiceForbiddenException".
the header is:
POST /feeds/default/private/full HTTP/1.1
Host: docs.google.com
GData-Version: 3.0
Authorization: OAuth 1/VbdXxNS9HXN1Q3pe8D....
Content-Type: text/html; charset=UTF-8
Slug: test.html
Content-Length: 2109
....content.....
any idea?
Shouldn't that be an HTTPS URL? Can you show more of the URL that you are using?
I found the java/samples/DocumentList.java tutorial included in the gdata release very helpful in hunting down these things.