Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Sending Flash variables to email using ASP

Posted on 2008-10-01
8
Medium Priority
?
677 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

636 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