Reputation: 106920
I have to send an email which contains a picture and some text around it. I can already send a HTML email, attach a picture with Content-ID: <Picture.jpg>
and then reference it as <img src="cid:Picture.jpg" alt="" />
. Cute.
The problem - many mail clients don't display it by default. For example, GMail, by default, shows pictures only from senders to which you have sent at least two emails. I've no idea about Mozilla Thunderbird, but judging by the complaint of the customer, it does something similar - the picture is displayed as an attachment and does not appear in the email body.
What am I doing wrong / could do better?
Here's a [censored]
copy of an email:
Delivered-To: [censored]
Received: by 10.204.187.8 with SMTP id cu8cs411179bkb;
Wed, 4 Jan 2012 05:36:05 -0800 (PST)
Received: by 10.152.106.45 with SMTP id gr13mr25346083lab.9.1325684164222;
Wed, 04 Jan 2012 05:36:04 -0800 (PST)
Return-Path: <[censored]>
Received: from [censored] ([censored]. [[censored]])
by mx.google.com with ESMTPS id nq10si44421925lab.26.2012.01.04.05.36.03
(version=TLSv1/SSLv3 cipher=OTHER);
Wed, 04 Jan 2012 05:36:03 -0800 (PST)
Received-SPF: pass (google.com: best guess record for domain of [censored] designates [censored] as permitted sender) client-ip=[censored];
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of [censored] designates [censored] as permitted sender) smtp.mail=[censored]
Received: from [censored] ([censored]) by [censored] ([censored]) with
Microsoft SMTP Server id 8.1.436.0; Wed, 4 Jan 2012 15:36:03 +0200
MIME-Version: 1.0
From: [censored]
To: [censored]
Date: Wed, 4 Jan 2012 15:36:02 +0200
Subject: Test
Content-Type: multipart/mixed;
boundary="--boundary_1_5d3b21f4-0e5d-4727-a2a2-a49bb2ad5062"
Message-ID: <e42be75d-53b2-46c7-a1c6-150c95b86ba6@[censored]>
Return-Path: [censored]
----boundary_1_5d3b21f4-0e5d-4727-a2a2-a49bb2ad5062
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: base64
[snip base64 encoded HTML]
----boundary_1_5d3b21f4-0e5d-4727-a2a2-a49bb2ad5062
Content-Type: image/jpeg; name="Picture.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
Content-ID: <Picture.jpg>
[snip base64 encoded JPEG]
----boundary_1_5d3b21f4-0e5d-4727-a2a2-a49bb2ad5062--
Added: To the downvoters - although I do see the misuse potential in this question, the truth is that this is from a legitimate scenario. I'm making a web shopping site for an office stationery supplier. The client wants a "send to email" button in the product page, so that visitors can send interesting product descriptions to their friends/bosses/whatever. I'm trying to include the product picture in the email. The client is complaining that the image is not shown.
Upvotes: 4
Views: 23759
Reputation: 9533
Copied from this answer:
The value of the Content-ID
header is supposed to be in the same format as a message-id, which in turn looks very much like an email address. <Picture.jpg@yourmailer>
has a better chance of working with most mailers.
Upvotes: 1
Reputation: 7518
Most email clients will always hide the images in the body of an html email unless it is sent from a trusted sender. Think about it, if some spam site were to send you inappropriate images, would you want them to pop up when you open the email?
The only thing you can do is to ask the recipients to select the option on the email to always show images from this sender. Also, from my experience often the images are not sent as an attachment on the email, but instead the image tag points to an image hosted by the sender.
Upvotes: 0
Reputation: 16104
I do not think you can force email clients to display emails in a certain way. Just think about the security issues this would impose!
Maybe you can find out the options to configure in the customer's client and recommend them to him.
Upvotes: 0