You are on page 1of 5

How to Send Email with Flash and ASP

06/29/2003
by Kenn Schroder

The tutorial will assume the reader is relatively new to Flash, and has no real working knowledge of
ASP. At the same time, the tutorial will not go into excessive detail regarding non-Flash items.
Try It Out
Try out the Flash E-mailer
Purpose

1. What are the advantages of being able to send email using Flash? There are several.
2. First off, by creating a Flash movie that can send email, you will have in effect, created a remote
email sender. This is great if you are not at home where your mailing software (ex Outlook) is
not available.
3. Also if you do not even have an email address, or any emailing program, or do not even own a
computer, and you need to contact someone who does have an email address, you can use this
Flash movie to do so.
4. From a cosmetic web site point of view, the ability to send email within a Flash movie or Flash
web site is more appealing then having to open up the client’s email program(ex Outlook),
which you can suspect will look nothing like your web site or movie. In fact, many visitors,
especially new ones, which are popping up on the web almost every second, may have actually
thought that they left your site, for example my aunt.
5. Also, by opening up the computers email program, your visitor will have to wait. Waiting time is
one of the largest considerations when building sites, even Flash sites. Not only is the waiting
less than ideal, your visitor’s attention is drawn away from your site, and may even get
permanently diverted into reading his/her own email.
6. Finally, a great reason to add email ability to your movie or site, is to get feedback. Combined
with a simple survey using form elements, you can make a quick and easy to fill out feedback
email.

Background

 An ASP page is an active server page. The purpose of ASP is to perform certain tasks on
the server. One of these tasks is to send email.
 This tutorial is based on a server/client environment. The person (you) at your
computer is viewing a Flash movie on your computer, is the client. A computer
elsewhere(on the web for example) will run the ASP page and send your mail, is the
server.
 So in summary, your Flash movie will run on your computer, gather the email
information from you, and send it to the ASP page. The ASP page will take that email
information and send out the email. Simple.

Here are the steps.

1. Step 1 – Flash Movie


Make a Flash movie, I called mine flashemail.fla. There will only be one frame in this movie.
2. Step 2 – Add Text
Add static text and input text, as shown in the screenshot below. To do this, use the text tool,
along with the character panel and the text options panel. Name the input text fields emailfrom,
emailto, emailsubject, and emailbody. (notice in the screenshot below, the input field under the
text “message” is outlined in blue, and in the text options panel, the associated variable is
emailbody.)

3. Step 3 – Add buttons


Add two buttons to the bottom, one to clear the form and one to send the email. I named mine
clear and send. Add the action-script to each of the buttons, as I have done in the below
screenshots.

on (release) {
emailto = "";
emailfrom = "";
emailsubject = "";
emailmessage = "";
}

on (release) {
getURL ("http://www.lifug.org/kenn/mail.asp", "_blank", "GET");
}
4. Step 4 – Create ASP Page.
In any text or.asp editor of your choice, create the below page. The URL for this page needs to
be obtained and entered into the action-script that lies on the send button, as above. If you
wish, you can skip this section and simply use the already created ASP page at (note: the
address of the asp page in the picture above does not exist. You will need to make the asp page
available on the internet.)

<.asp>
<head>
<title>Emailer ASP</title>
<meta http-equiv="Content-Type" content="text.asp; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">

<%

Dim strFrom, strTo, strSubject, strBody

strFrom = Request.Querystring("emailfrom")
strTo = Request.Querystring("emailto")
strSubject = Request.Querystring("emailsubject")
strBody = Request.Querystring("emailbody")

Dim MyMail
Set MyMail = Server.CreateObject("CDONTS.NewMail")

MyMail.From = strFro
MyMail.To = strTo
MyMail.Subject = strSubject
MyMail.BodyFormat = 1
MyMail.MailFormat = 0
MyMail.Importance = 2
MyMail.Body = strBody
MyMail.Send

Set MyMail = Nothing

%>

Your email has been sent.

</body>
<.asp>

Done
Here are a few key points about the ASP page above. The series of “Request.Querystring” is used to
pull in the values from Flash. The “MyMail” object is created on the server, and it holds the email
information from the Flash movie. After the properties of the object are set, the actual send of the
email is performed by the method “Send” as in the line “MyMail.Send.”

Here ends the tutorial. Enjoy.

You might also like