[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1155
  • Last Modified:

Send email from Flash form

I am trying to create a form in Flash that gets a users email address and sends it to an email address I specify. I've looked at countless tutorials and I just don't get it. I need something simple and I can't seem to find anything like this. I have a text box for the user to enter the email address and a button. What scripts do I need to place on the button and what should my asp page look like? I'll take whatever I can get at this point this is clear and easy to understand and edit. Thanks!
0
apriilgem
Asked:
apriilgem
  • 6
  • 6
  • 2
  • +1
1 Solution
 
biztigerCommented:
0
 
apriilgemAuthor Commented:
Thanks but I need to know how to make this work with Flash 8.  How do I get the input from the text field in Flash and send it to the asp page, which will then email it to another address? I don't understand how to edit this example to suit my purpose. Don't I need to put in the mail server information? I do know a little bit about asp, but not enough to solve this problem.
0
 
crooksy88Commented:
First of all. Get your asp file working correctly. i.e create a html form and use this to test the asp file sends the email to wherever you are wanting to send it.

Once you know this is working you're half way there.

If you let me know the name of the asp script the form is sending to and the name of the email field I'll knock up a quick flash file for you so you can see what is happening.
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.

 
biztigerCommented:
Go through the article. Start with "Creating the Flash Form" and end reading on page 3 (after you learn how to recieve dat from flash to asp)
http://www.sorbose.com/pdf/Build%20a%20Database%20with%20Flash%20form%20&%20ASP.pdf

You'll know everything how to send data from flash to asp effectively. Now after receiving the data in asp, go through the following tutorial to send the email from asp.

Check this out to know how to send email with asp
http://www.sitepoint.com/article/sending-email-asp/
0
 
apriilgemAuthor Commented:
Ok, I've searched around and this is the code I ended up with:

<%
set myMail=CreateObject("CDO.Message")

myMail.Subject="Sending email with CDO"
myMail.From="remi@designdal.com"
myMail.To="remi@designdal.com"
myMail.TextBody="This is a message."

myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "sendmail4.brinkster.com"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Update
myMail.Send

%>


I am trying to make the asp work first as suggested and then go from there. This does not work however and gives me this error message:

(error '8004020f'
/tp/mailtest.asp, line 28 )

Can someone please let me know what I might be doing wrong.


0
 
apriilgemAuthor Commented:
I've been able to get the code to work to send email, but now I need to figure out how to get it to get info from a flash form. This is the code that ended up working for me:

<%
set myMail=CreateObject("CDO.Message")

myMail.Subject="Sending email with CDO"
myMail.From="remi@designdal.com"
myMail.To="remi@designdal.com"
myMail.TextBody="This is a message."

myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "sendmail4.brinkster.com"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "remi@designdal.com"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

myMail.Configuration.Fields.Update
myMail.Send

%>

I'm halfway there! I just need help with the last part.
0
 
crooksy88Commented:
The attached fla is an example of how the flash form posts data to the asp script.
In this example the variables username and passwd are passed (currently to login.asp)

This solution requires the asp script to send something back to the browser, such as a new page or Location URL.

FYI you can also send data from flash without refreshing the contents of the browser window using sendAndLoad. Flash Help has some great examples for you to try out if this options is preferred.
sendData.fla.txt
0
 
apriilgemAuthor Commented:
Thanks, but that file comes up looking crazy and I can't read it.
0
 
crooksy88Commented:
try downloading the file and removing the .txt from the name so you end up with a .fla extension
0
 
apriilgemAuthor Commented:
Ok, I've got it so that when i enter info into the Flash form, it goes to the email address, but the info that shows up has the textbox attributes included from the Flash file. How would I get rid of this and just have it so that only what the user typed into the box shows up?

Also, now that I've figured all this out, I find out the server doesnt support asp files unless I create and .htaccess file. Anyone know how I would go about doing that? Its slow going, but I'm getting it in pieces...lol
0
 
crooksy88Commented:
The separation of the name/value pairs is something that the .asp file does. Unfortunately I don't know anything about asp!

If it were done using PHP the code would look something like:

$email = $_POST['email'];
$message = $_POST['message'];
0
 
apriilgemAuthor Commented:
Ok, then can you tell me how to do the same thing I am trying to do using php? I don't have time for a whole tutuorial. I would just love the code. Or something close to what I need and I can alter it to suit my purpose. Thanks!
0
 
crooksy88Commented:
Here you go. This php script requires the variables name, email and message.



<?php
//get info from form post
 
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
 
  
	//Mail Header Variables
	$xSenderName = "Your Name";
	$xSenderEmail = "you@yourdomain.com";
	$xServerName = "yourdomain";
 
	$to = "$you@yourdomain.com";
	
	$subject = "From form";
	
	$message ="Name: $name<br /><br />";
	$message .="Email: $email<br /><br />";
	$message .="Message: $message<br /><br />";
	
	$headers="";
	$headers .= "X-Sender: $xSenderName <$xSenderEmail>\n"; //
	$headers .= "From: $xSenderName <$xSenderEmail>\n";
	$headers .= "Reply-To: $xSenderName <$xSenderEmail>\n";
	$headers .= "Date: ".date("r")."\n";
	$headers .= "Message-ID: <".date("YmdHis")."$xServerName@".$_SERVER['SERVER_NAME'].">\n";
	$headers .= "Return-Path: $xSenderName  <$xSenderEmail>\n";
	$headers .= "Delivered-to: $to <$to>\n";
	$headers .= "MIME-Version: 1.0\n";
	$headers .= "Content-type: text/html;charset=ISO-8859-1\n";
	$headers .= "X-Priority: 3\n";
	$headers .= "Importance: Normal\n";
	$headers .= "X-MSMail-Priority: Normal\n";
	$headers .= "X-Mailer: PHP 5.1\n";
	
	mail($to, $subject, $message, $headers);  
 
		
echo "email sent";
?>

Open in new window

0
 
CEGECommented:
hello:

I was looking at this solution but had a doubt about what should go in here.

$headers .= "Message-ID: <".date("YmdHis")."$xServerName@".$_SERVER['SERVER_NAME'].">\n";

Should the real mail server name go in place of 'SERVER_NAME' or not? I wasn't sure where the server name, for example. mail.domain.com or smtp.domain.com should go.

Thanks,

joseph
0
 
crooksy88Commented:
That line shouldn't need to be altered. .$_SERVER['SERVER_NAME']. is taken from the environment vars.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 6
  • 6
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now