Solved

Sending Flash variables to email using ASP

Posted on 2008-10-01
8
662 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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 500 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

726 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