Hi guys, I'm trying to figure out how to create the html portion of a mail with images in. It looks something like this: <img src="cid:image.gif"> and then at the end of the mail: Content-Type: image/gif; name="image.gif" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="image.gif" Content-ID: <image.gif> It looks as if all I have to do is encode the image with base64, dump the contents and paste that output into the mail. Is this right? How do I encode an image with base64? Thanks Hans
On Sat, 2006-09-16 at 10:04 +0200, Anders Johansson wrote: > On Saturday 16 September 2006 09:59, Hans du Plooy wrote: > > How do I encode an image with base64? > > With uuencode, for example Thanks, that's the one! > Are you writing your own mail client? No, I'm trying to help a client develop a way to make good looking newsletters. The only mail client that seems to work alright is Outlook Express but formatting is limited, and with Thunderbird/Moz Mail what you see is not always quite what you get. I've given up on mail clients - they either don't do the formatting right or don't embed the images porpery (i.e. make place holders and stick the images at the bottom) or something inbetween. The client I'm helping is a graphic designer with limited html experience. I have no html experience, but I understand a little bit about how mail works :-) Thanks Hans
On Friday 15 September 2006 23:59, Hans du Plooy wrote:
It looks as if all I have to do is encode the image with base64, dump the contents and paste that output into the mail. Is this right?
How do I encode an image with base64?
Yeah thats about right. http://www.faqs.org/rfcs/rfc3548.html Basically you take 24 bits (3 characters,) and rip the bits off 6 at a time into 4 numbers, and look each number up in a table and substitute the corresponding letter from that table. -- _____________________________________ John Andersen
On Saturday 16 September 2006 09:59, Hans du Plooy wrote:
Hi guys,
I'm trying to figure out how to create the html portion of a mail with images in.
It looks something like this:
<img src="cid:image.gif">
and then at the end of the mail:
Content-Type: image/gif; name="image.gif" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="image.gif" Content-ID: <image.gif>
It looks as if all I have to do is encode the image with base64, dump the contents and paste that output into the mail. Is this right?
How do I encode an image with base64?
Do you mean the 'data' protocol? See K-menu -> System -> Monitor -> Protocols, choose 'data'. There are some examples there, and a reference to RFC2397. If the answer is yes, read on; otherwise disregard. The trick is to encode the data with base64 (as you and others pointed out). On my system (SL 10.1) I have no uuencode, but uuenview. From the example in RFC2397, use: <img src="data:image/gif;base64,*" alt="Larry"> in your html-file. Replace the asterisk "*" with the output of uuenview -b <filename>.gif. If your images are not gif images, you need to change the mime type accordingly. To find out what the mime type of the image is, do: file --mime --brief <filename> and replace "image/gif" with the output *** Please note: Konqueror 3.5.4, Opera 9.0 and FireFox 1.5.0.7 support the data: scheme. I'm not sure if IE does. Cheers, Leen
On Saturday 16 September 2006 13:09, Anders Johansson wrote:
On Saturday 16 September 2006 13:06, Leendert Meyer wrote:
On my system (SL 10.1) I have no uuencode, but uuenview.
it is in the package sharutils, it is included in 10.1
Ah thanks! I did a quick search in YaST, but could not find it... ;) Alas the output of uuencode -m 'Larry.gif' < Larry.gif is not suitable for the data: scheme (Larry.gif is just an example), uuenview's out put is. Cheers, Leen
On Sat, 2006-09-16 at 13:06 +0200, Leendert Meyer wrote:
The trick is to encode the data with base64 (as you and others pointed out). On my system (SL 10.1) I have no uuencode, but uuenview. From the example in RFC2397, use:
<img src="data:image/gif;base64,*" alt="Larry">
in your html-file. Replace the asterisk "*" with the output of uuenview -b <filename>.gif. [snip]
Thanks Leendert, this is all very useful. Thanks Hans
participants (4)
-
Anders Johansson
-
Hans du Plooy
-
John Andersen
-
Leendert Meyer