views:

111

answers:

4

Hi ,

How to embedded flash on email body ,

Using php (email function)

+5  A: 

I don't think you can embed flash in an email message. Email clients (at least those I'm familiar with) don't render flash or support the plugin (unless someone else know of some that do).

g.d.d.c
A: 

This question doesn't really have anything to do with PHP. What you are really asking is how to use Flash in an HTML e-mail. This isn't possible. E-mail clients ignore plugins, Javascript, etc. They also ignore a great deal of HTML.

Brad
+2  A: 

You would have to use an HTML mail with an <embed> tag and an included multipart/related resource for the SWF file, in the same way you do inline images. See eg this example.

But there is no point in trying: the vast majority of e-mail clients aren't going to display it. E-mail clients (including webmail providers) have extremely limited and variable support for HTML features like CSS and JavaScript that are taken for granted on a normal web page. Plugins like Flash? Totally out of the question. (And thank god. Last thing I want in my mailbox is a bunch of noisy flashing CPU hogs.)

Authoring HTML that actually displays as intended on a wide range of mail clients is an exercise in frustration, which is usually best avoided. Put it on a web page. Send a link in the mail. Job done.

bobince
+1  A: 

You can certainly embed a Flash .swf within an email as an attachment. The process is identical to attaching an image for in-line use. However, there's no way to get the Flash movie to actually play within the page.

If you were attaching an image, you'd do this, using PHPMailer:

$m = new PHPMailer();
$m->AddEmbeddedImage('/path/to/image.jpg', 'picture', 'picture', 'base64', 'image/jpeg');

And within the HTML body of the mail, you'd refer to the picture like this:

<img src="cid:picture" alt="The embedded picture" />

You can embed the Flash .swf using the exact same call sequence. However, there is no way to actually get the movie to play. The Flash plugin does not understand/honor the "cid:" method and so cannot read the .swf data from within the email body. At most you can attach the .swf and a copy of the offline Flash player .exe for the email recipient to save and run off their local machine.

Marc B