?
Solved

Sending Flash variables to email using ASP

Posted on 2008-10-01
8
Medium Priority
?
667 Views
Last Modified: 2010-08-05
Hi,
I've been stumped for the last while. Need help on this problem. I have a flash movie that I have published in an html. The Flash has a form that "onRelease" sends the form variables to a mailer.asp page for processing through SMTP mail on the server. The server is running MS Server 2003. When I fill out the form in the flash site and hit the send button I get the email but the variables are not sent. I only get (Name:_____, Email:______ etc). I have a code problem here.

Thanks All!!
Flash : On Release
==================================================
on (release) {
	for (i=1; i<_parent.fields_descriptions.length; i++) {
		this[_parent.fields_descriptions[i][2]] = _parent[_parent.fields_descriptions[i][1]];
		_parent.reset_txt(_parent["t"+i], _parent.fields_descriptions[i][1], _parent.fields_descriptions[i][2]);
	}
	this.recipient = _parent.rec;
	i = undefined;
	this._parent.getURL("mailer.asp", "", "POST");
}
=================================================
 
ASP Mailer : Mailer.asp
 
<%
'Email ASP Code 
'--------------------------------------------------------
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
 
'Change this RemoteHost to a valid SMTP address before testing
Mailer.RemoteHost  = "smtp.mailserver.ca"
Mailer.FromName  = Request("t1")+" " +Request("t2")
Mailer.FromAddress = "info@mailserver.ca" 
Mailer.AddRecipient  "Title", "test@mailserver.ca"
 
Mailer.ReturnReceipt = true
Mailer.Subject     = "Seacan Website Inquiry"
Mailer.BodyText    = "Name : " + Request("t1")
Mailer.BodyText    = "E-Mail : " + Request("t2")
Mailer.BodyText    = "Phone : " + Request("t3")
Mailer.BodyText    = "Message : " + Request("t4")
 
 
if not Mailer.SendMail then
  Response.Write " Mailing Failed... Error is: <br>"
  Response.Write Mailer.Response
else
  Response.write "<center><font color=blue>"
  
end if
%>
<html>
<head>
<title>E-Post Message Sent</title>
</head>
 
<body bgcolor="#FFFFE8">
<p align="center"><font face="Century Gothic" size="5">Message Sent</font>
<p align="center"><font size="3" face="Arial"><a href="sendmail1.htm" target="_top">Return
to the Send Mail tutorial</a></font></p>
</body>
</html>

Open in new window

0
Comment
Question by:wtran
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 10

Expert Comment

by:slamhound
ID: 22620970
I'm no Flash expert but I can see where ASP is not getting your variables.

You need something like:
this._parent.getURL("mailer.asp?t1=Fred&t2=Smith", "", "POST");

with Fred and Smith being from your variables.

I just can't see where you are passing the variables in your flash code.
0
 

Author Comment

by:wtran
ID: 22627741
Thanks, how do I pass variables from flash to the mailer.asp Page.  If I hard code "Fred" and "Smith". That seems to work.

Any idea how I could get this to work?

Thanks in advance.
0
 
LVL 10

Expert Comment

by:slamhound
ID: 22630284
Depends on what your variables are but you could try something like...

this._parent.getURL("mailer.asp?t1=" + this.recipient + "&t2=" + this.recipient, "", "POST");

Replace "this.recipient" with your variables and replace "+" with whatever Flash uses to join strings together.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:wtran
ID: 22631307
Thanks, yes I've tried this and all I get now is the variable that I'm trying to pass says that it is undefined. Then it puts the word "undefined" where the variable should be.  I tried request(t1), this.t1, this._parent.t1.  All with the same results.

The variables are on a flash form. (var t1)

Are there other ways of getting variables from a flash form ?

Thanks again
0
 
LVL 10

Expert Comment

by:slamhound
ID: 22631362
What does reset_txt do?

Try _parent["t1"] or _parent.fields_descriptions[1][1]
0
 

Author Comment

by:wtran
ID: 22635132
I tried _parent["t1"] and nothing was returned.  Then I tried _parent.fields_descriptions[1][1] and "T1" was returned.

Anything else I could try?

Tks

Will
0
 

Author Comment

by:wtran
ID: 22638971
Hello Experts, perhaps more info is required

This here would be my initial load:
//==================================
rec="test@test.com";
serv="asp";

var fields_descriptions= Array ("",
                                                      Array("t1", "yname", "Your Name:"),
                                                      Array("t2", "yemail", "Your Email:"),
                                                      Array("t3", "tphone", "Telephone:"),
                                                      Array("t4", "message", "Message:")                                                                                          );
function reset_txt(name,name2,value) {
            path=eval(_target);
            path[name2]="";
}
for (i=1; i<=fields_descriptions.length; i++) {
      reset_txt("t"+i, fields_descriptions[i][1], fields_descriptions[i][2]);
}

//==================================

Then this is my submit button

//==================================
onClipEvent (enterFrame) {
      if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
            if (this._currentframe<this._totalframes) {
                  this.nextFrame();
            }
      } else {
            if (this._currentframe>1) {
                  this.prevFrame();
            }
      }
}
on (release) {
      for (i=1; i<_parent.fields_descriptions.length; i++) {
            this[_parent.fields_descriptions[i][2]] = _parent[_parent.fields_descriptions[i][1]];
            _parent.reset_txt(_parent["t"+i], _parent.fields_descriptions[i][1], _parent.fields_descriptions[i][2]);
      }
      this.recipient = _parent.rec;
      i = undefined;
      getURL("mailer."+_parent.serv, "_blank", "POST");
}
//=======================================

Then this is my ASP page.

//=========================================

<%
'Email ASP Code
'--------------------------------------------------------
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")

'Change this RemoteHost to a valid SMTP address before testing
Mailer.RemoteHost  = "smtp.seacan.ca"
Mailer.FromName  = Request("yname")+" " +Request("yemail")
Mailer.FromAddress = "test@test.com"
Mailer.AddRecipient  "name", "test@test.com"

Mailer.ReturnReceipt = true
Mailer.Subject     = "Website Inquiry"
Mailer.BodyText    = "Name : " + Request("yname")
Mailer.BodyText    = "E-Mail : " + Request("yemail")
Mailer.BodyText    = "Phone : " + Request("tphone")
Mailer.BodyText    = "Message : " + Request("message")


if not Mailer.SendMail then
  Response.Write " Mailing Failed... Error is: <br>"
  Response.Write Mailer.Response
else
  Response.write "<center><font color=blue>"
 
end if
%>
<html>
<head>
<title>Seacan E-Post Message Sent</title>
</head>

<body bgcolor="#FFFFE8">
<p align="center"><font face="Century Gothic" size="5">Message Sent</font>
<p align="center"><font size="3" face="Arial"><a href="http://www.seacan.ca" target="_top">Return
to Seacan Online</a></font></p>
</body>
</html>
//==========================

My issue is that the email is sent, I get confirmation that the email is sent.  But I'm having problems getting the variables from the flash page to the ASP page.  I've tried request(XXXX), POST, GET.  

I am exporting it out as Flash 8.0 on Flash CS3

Thanks in advance.
0
 
LVL 10

Accepted Solution

by:
slamhound earned 1500 total points
ID: 22646529
ah! An array of data! Makes more sense now. :)

this._parent.getURL("mailer.asp?yname=" + _parent.fields_descriptions[1][2] + "&yemail=" + _parent.fields_descriptions[2][2]", "", "POST");

This assumes that arrays in Flash are zero based. so [1][2] = "Your Name" and [2][2] = "Your Email"

Just make sure that this isn't deleting all the variables:
for (i=1; i<=fields_descriptions.length; i++) {
      reset_txt("t"+i, fields_descriptions[i][1], fields_descriptions[i][2]);
}
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question