How to manually embed a flash movie (swf) in an email message

For the benefit of ayone who may be interested in sending an HTML e-mail that references an swf (Flash) movie (or anything else for that matter) embedded within the same e-mail message, here is a complete description of how to go about it.

The process is totally manual since e-mail clients (yes, Outlook included) do not support such operations. Also note that such e-mails only work on e-mail clients that do support HTML viewing (like Outlook and Netscape Messenger).

First you have to manually compose the source code for your mail message. This code includes multiple message parts. One part is the HTML message that will be viewed by the mail recipient and another part is the movie attachment that we will reference with the CID link within the HTML code. The message is of the type multipart/related and should be so in order to ensure that the the CID links work.

Here is a sample that I have recently used to convey my XMas wishes to my friends (it worked for all microsoft, eudora and netscape mail clients):

From: Fotios
To: Everyone@I_Like
Reply-To: fotios@altavista.net
Subject: xmas wishes
Mime-Version: 1.0
X-Mailer: MyFingersAreSore 0.1
Content-Type: multipart/related; boundary="wootsoo-wootsoo-eh"; type=Text/HTML

--wootsoo-wootsoo-eh
Content-Type: Text/HTML; charset=US-ASCII

<HTML>

<HEAD>
<TITLE>Merry Christmas & A Happy 2001...(You need the Flash plug-in to view this)</TITLE>
</HEAD>

<BODY bgcolor="#FFFFFF">

<!-- URL's used in the movie-->

<!-- text used in the movie -->
<!--Fotios your friend, Wishes you, Merry Christmas & A Happy 2001-->

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://active.macromedia.com/flash2/cabs/swfla sh.cab#version=4,0,0,0"
ID=wishes WIDTH=500 HEIGHT=440>
<PARAM NAME=movie VALUE="cid:flash*wishes@turbofotios">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<EMBED src="cid:flash*wishes@turbofotios"
quality=high
bgcolor=#FFFFFF
WIDTH=500
HEIGHT=440
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/shockwave/downloa d/index.cgi?P1_Prod_Version=ShockwaveFlash">
</EMBED>
</OBJECT>

<br>If you do not see the movie above, install the Macromedia Flash 4.0 or 5.0 browser plug-in,<br>
relax your browser's security settings, or try the links below</font><br>
<a href="cid:flash*wishes@turbofotios">Wishes (local)</a><br>
<a href="http://members.madasafish.com/~pitinc/wishes.swf"> Wishes (remote)</a><br>
In case of problems just copy/paste the url below into your browser<br>
http://members.madasafish.com/~pitinc/wishes.swf<br><br> <br>
<div align="center">
<p><font size="6"><b><font color="#00CC00">Merry Christmas </font></b></font></p>
<p><b><font size="6">&</font></b></p>
<p><b><font size="6" color="#FF3333">A Happy 2001</font></b></p>
<p><b><font size="4">from Fotios</font></b></p>
<p> </p>
</div>

</BODY>

</HTML>

--wootsoo-wootsoo-eh
Content-ID: flash*wishes@turbofotios
Content-Description: "Base64 encode of wishes.swf by FotiosTralala"
Content-Type: application/x-shockwave-flash; name="wishes.swf"
Content-Transfer-Encoding: Base64
Content-Disposition: attachment; filename="wishes.swf"

RldTBHNUBQB4AATiAAARMAAADMYBQwL///+GBAsrLAeGBr8APwAAAAEA VODITgyAAAEUAGYAmQEl
SJXZnOZyAKin/6ixpynxxysAAnr4AxmOnx2OANen/9eOWOnOmOUIAnUA AORyAI8GBgMAAQDJW+dW
+c8ojI20jwYGAgABAMknY0nYzyiMjbSKBgYBAAEAHlEZG2i/AxUDAAAC ACYpBAAAfgb/4zDAAAAA

--- The base64 code goes on for many more lines here but I cut it for brevity ---

That is all! Of course you can include more parts in the mail message using the same syntax illustrated in the code above.

To actually send the e-mail you need to do 2 more things:

1. Download the wincode utility or my own MIME encoding lib which is obviously not as easy to use. You can find Wincode in all major shareware/freeware download sites like zdnet.com With the wincode utility u will be able to easily encode any binary file (like the swf movie) into base64 ASCII code. This code is the code u should supply as the flash (second) part of the message above that I have cut short for brevity (since it was about 400K long). Wicode creates its own headers for the encoded part. Make sure you edit them according to the headers I used for the second part of the message above.

2.Connect to your SMTP server (e.g. smtp.myisp.com) with your TELNET client (SMTP port is 25)
Go through the SMTP protocol sequence manually. Here is a sample SMTP session with my local Microsoft SMTP server (every second line is input that I have typed on my keyboard):

220 turbofotios Microsoft ESMTP MAIL Service, Version: 5.0.2195.1600 ready at Wed, 14 Feb 2001 16:38:13 +0000
helo
250 turbofotios Hello [127.0.0.1]
mail from: fotios@turbofotios
250 2.1.0 fotios@turbofotios....Sender OK
rcpt to: lonewolf@turbofotios
250 2.1.5 lonewolf@turbofotios
rcpt to: mitsos@turbofotios
250 2.1.5 mitsos@turbofotios
data
354 Start mail input; end with <CRLF>.<CRLF>
tralala
.
250 2.6.0 <TURBOFOTIOS32Uh3Qpq00000002@turbofotios> Queued mail for delivery

That is all. Of course you could give many more RCPT addresses for everyone you wanted to send the message to or you could put all the addresses in the To: header of the mail message and rely on the server process to parse the header and send the message to everybody there. After the 354 line I have put the string "tralala" for illustration purposes. Obviously you put the mail message there (cut from your editor and paste on your telnet client)instead of "tralala"! Do not forget the full stop on a separate line at the end. This is important as it signifies to the SMTP server the end of the DATA part of the session.

Happy e-mailing and good luck to the brave!

FöTïö§
"The bug in debug"

PS Here I have a more complete example of what the manual email message could look like

Post new comment

The content of this field is kept private and will not be shown publicly.

Share

  submit to reddit