PDA

View Full Version : GoDaddy Flash email forms


ForrestM
11-26-2008, 08:44 PM
I have tried at least 6 online tutorials where you create a Flash CS3 email form in actionScript 2.0 and a corresponding php file. I enter my email address in the PHP code as a recipient and I point the swf at the domain address/file.php, but it never works. What am I missing? Is GoDaddy different than all other web hosters?
Here is my PHP code;

<?PHP

$to = "someguy@somewhere.com";
$subject = "Flash Contact Form Submission";
$message = "Name: " .$theName;
$message .= "\nEmail: ". $theEmail;
$message .= "\n\nMessage: " . $theMessage;
$headers = "From: $theEmail";
$headers .= "\nReply-To: $theEmail";

$sentOk = mail($to,$subject,$message,$headers);

echo "sentOk=" . $sentOk;


?>
Here is my Flash code;
stop();

var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();

sender.onRelease = function() {
senderLoad.theName = theName.text;
senderLoad.theEmail = theEmail.text;
senderLoad.theMessage = theMessage.text;
senderLoad.sendAndLoad("http://www/somegodaddydomain.com/send.php",receiveLoad);
}

receiveLoad.onLoad = function() {
if(this.sentOk) {
_root.gotoAndStop("success");
}
else {
_root.gotoAndStop("failed");
}
}


Does there need to be other information in the php code for goDaddy to generate emails?
:eek:

CyanBlue
11-26-2008, 09:03 PM
Howdy and Welcome... :)

Maybe this page can help you...
http://forums.devarticles.com/web-hosting-45/php-mail-function-not-working-with-godaddy-com-90663.html

It's basically saying that you have to have this line in your PHP script...
include_once("Mail.php");

ForrestM
11-26-2008, 09:27 PM
Thanks fior the link CyanBlue.

I amended my PHP file to read;

<?PHP

include_once("Mail.php");

$to = "fmolstad@theherald.canwest.com";
$subject = "Flash Contact Form Submission";
$message = "Name: " .$theName;
$message .= "\nEmail: ". $theEmail;
$message .= "\n\nMessage: " . $theMessage;
$headers = "From: $theEmail";
$headers .= "\nReply-To: $theEmail";

$sentOk = mail($to,$subject,$message,$headers);

echo "sentOk=" . $sentOk;

?>


But it still does not work.

In that thread you sent me eonymoose said my hosting settings need to be PHP Linux not ASP Windows. We are set up as ASP Windows, so could that be my problem?
:confused:

CyanBlue
11-26-2008, 09:29 PM
Well... Does that ASP Windows setup allow you to run PHP code??? I do not know... Some host allow you to run PHP even if the plan name says ASP... You'll need to check with godaddy...

ForrestM
11-26-2008, 09:47 PM
Well here is the info on goDaddys site in our account;

.Net Runtime Versions
Version 3.5 of the .NET runtime is backward compatible with versions 3.0 and 2.0.

Full support for PHP 5 is enabled by default on all accounts running IIS 7. With PHP 5, you can install a variety of quick-install applications and integrate PHP 5 scripts and code into your site.

NOTE: It can take up to 24 hours to activate a language on your hosting account.

NOTE: PHP 4 is not supported on IIS 7 accounts.

I did contact goDaddy and they really seemed confused as to what to tell me. They told me that I should change the extension from .php to .php5 and that I should add this to my php code;

// Set this anytime before the mail() function is called
ini_set('sendmail_from', 'user@domain.tld'); // Set only on Windows
ini_set('SMTP', 'relay-hosting.secureserver.net');

I am clueless as to how to apply all this...:rolleyes:

matthew.risch
02-24-2009, 01:28 AM
I have the same issue and have been at it for days.
Any solution to this?

ForrestM
02-24-2009, 05:18 AM
Matt, just do this;
Works like a charm on GoDaddy windows servers
Forrest

<?PHP

ini_set('sendmail_from', 'user@domain.tld'); // Set only on Windows
ini_set('SMTP', 'relay-hosting.secureserver.net');

$to = "somebody@somewhere.com";
$subject = "Flash Contact Form Submission";
$message = "Name: " .$theName;
$message .= "\nEmail: ". $theEmail;
$message .= "\n\nMessage: " . $theMessage;
$headers = "From: $theEmail";
$headers .= "\nReply-To: $theEmail";

$sentOk = mail($to,$subject,$message,$headers);

echo "sentOk=" . $sentOk;

?>

matthew.risch
02-25-2009, 02:14 AM
That did work! Although I'm on a Lynix GoDaddy server, I just removed the windows specific ini_set and replaced it with include_once("mail.php");
Now my problem is none of the variables are being passed through.
$headers = "From: $theEmail";
is coming up with this crazy address:
matthewrisch@p3nlh010.shr.prod.phx3.secureserver.n et
and none of the other variables are passed either.
I'm just using loadVariables in Flash to post them to the php file.
Thoughts on why this isn't working?

matthew.risch
02-25-2009, 03:49 AM
Just wanted to let you know I got some things figured out.
Below is the PHP:

<?PHP
include_once("mail.php");
ini_set('SMTP', 'relay-hosting.secureserver.net');
$to = "myemail@email.com";
$email =$_POST['theEmail'];
$subject =$_POST['theSubject'];
$message =$_POST['theMessage'];
$headers = "From: $email";
$headers .= "\nReply-To: $email";
$sentOk = mail($to,$subject,$message,$headers);
?>

And here's the AS in the frame the button lives in:

myButton.onPress = function() {
var myLoadVars = new LoadVars();
myLoadVars.theSubject = theSubject.text;
myLoadVars.theEmail = theEmail.text;
myLoadVars.theMessage = theMessage.text;
myLoadVars.send("http://www.somewebsite.com/mail.php");
};

The only issue I have left is the above PHP isn't putting the subject variable in the email's subject. Once I get that figured out, I'll post the code.

Thanks for steering me down the right path Forrest!

ForrestM
02-25-2009, 05:40 PM
Matt, this is what has been working for me. I hope this will help you out. :)

this is my Flash as2 code;
stop();

var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();

sender.onRelease = function() {
senderLoad.theName = theName.text;
senderLoad.theEmail = theEmail.text;
senderLoad.thePhone = thePhone.text;
senderLoad.theMessage = theMessage.text;
senderLoad.sendAndLoad("http://www.yourwebspace.com/your_mail.php",receiveLoad, "POST");
}

receiveLoad.onLoad = function() {
if(this.sentOk) {
_root.gotoAndStop("success");
}
else {
_root.gotoAndStop("failed");
}
}

this is my .php code;

<?PHP

ini_set('sendmail_from', 'user@domain.tld'); // Set only on Windows
ini_set('SMTP', 'relay-hosting.secureserver.net');

$theName = $_POST['theName'];
$theEmail = $_POST['theEmail'];
$thePhone = $_POST['thePhone'];
$theMessage = $_POST['theMessage'];

$to = 'primary.receiver@someaddress.com' . ', '; // note the comma
$to .= 'another.receiver@someaddress.com';

$subject = "This is the subject of the email";
$message = "Name: " .$theName;
$message .= PHP_EOL . PHP_EOL ."Email: $theEmail";
$message .= PHP_EOL . PHP_EOL ."Phone: $thePhone";
$message .= PHP_EOL . PHP_EOL ."Message: $theMessage";
$headers = "From: $theEmail";
$headers .= "\rReply-To: $theEmail";


$sentOk = mail($to,$subject,$message,$headers);

echo "sentOk=" . $sentOk;


?>


You might be wondering what the heck PHP_EOL is. This replaces \n or \p or \r and I am using this to format the email for web-based email such as Yahoo, Hotmail and gmail.

Hope this helps.
Forrest

Meb
05-13-2009, 01:14 AM
Hello!

I've been searching everywhere and came across this thread. It's been very helpful, but I am still having problems. I can't get my Mailing List Subscription form to work on my Flash Site. I'm also with Godaddy and they have basically been zero help so far.

My form just has 2 fields for name and email and then a submit button. The strange thing is that the way I have it now, I am able to receive the subscription emails if I test it locally from within Flash. But, as soon as I upload it to Godaddy it stops working! What's up with that?

However, even though when I test it from within Flash and receive the email, the "success" or "failed" response part still doesn't work for my form.

I've spent so many hours on this... Please help! :)

Here's my PHP:

<?PHP

ini_set('SMTP', 'relay-hosting.secureserver.net');

$theName = $_POST['theName'];
$theEmail = $_POST['theEmail'];

$to = 'contact@website.com' . ', ';

$subject = "Newsletter Subscription";
$message = "Name: " .$theName;
$message .= PHP_EOL . PHP_EOL ."Email: $theEmail";
$headers = "From: $theEmail";
$headers .= "\rReply-To: $theEmail";


$sentOk = mail($to,$subject,$message,$headers);

echo "sentOk=" . $sentOk;

?>


and here's my AS 2:

stop();

var senderLoad:LoadVars = new LoadVars();
var receiveLoad:LoadVars = new LoadVars();

sender.onRelease = function() {
senderLoad.theName = theName.text;
senderLoad.theEmail = theEmail.text;
senderLoad.sendAndLoad("http://www.website.com/send.php",receiveLoad, "POST");
}

receiveLoad.onLoad = function() {
if(this.sentOk) {
_root.gotoAndStop("success");
}
else {
_root.gotoAndStop("failed");
}
}

theName.tabIndex = 1;
theEmail.tabIndex = 2;

ForrestM
05-13-2009, 06:15 PM
Hi Meb, I am not sure if your GoDaddy hosted space is Linux or Windows based, but I am going to assume from you have said so far that it is a Windows based server.

So try replacing this line...
ni_set('SMTP', 'relay-hosting.secureserver.net');

With these two lines...

ini_set('sendmail_from', 'user@domain.tld');
ini_set('SMTP', 'relay-hosting.secureserver.net');

Forrest

Meb
05-13-2009, 06:44 PM
Thanks for the reply Forrest.

I should have included that information. Actually, GoDaddy has told me that it's Linux... so I don't think that will work :( I actually tried it both ways just to be sure :)

Since it works locally when previewing within Flash... what does that mean?

:confused:

thanks again.

ForrestM
05-13-2009, 08:05 PM
Well Meb, being a Mac guy I hesitate to say this but....

Maybe change the account from a Linux hosted to a Windows hosted. It is better anyway because the Windows hosted server will allow multiple FTP access.

If you do that I am sure the code will work.

Otherwise, check to make sure the path written in your flash file to the PHP file is accurate.

I have never worked with a GoDaddy Linux server so I am not sure what code you would need.

Sorry, if I think of anything I'll let you know.

matthew.risch
05-14-2009, 03:15 AM
Try this for the PHP:

<?PHP

include_once("mail2.php");
ini_set('SMTP', 'relay-hosting.secureserver.net');

$theName = $_POST['theName'];
$theEmail = $_POST['theEmail'];
$thePhone = $_POST['thePhone'];
$theMessage = $_POST['theMessage'];

$to = 'you@you.net' . ', '; // note the comma
$to .= 'you@you.net';

$subject = "email form";
$message = "Name: " .$theName;
$message .= PHP_EOL . PHP_EOL ."Email: $theEmail";
$message .= PHP_EOL . PHP_EOL ."Phone: $thePhone";
$message .= PHP_EOL . PHP_EOL ."Message: $theMessage";
$headers = "From: $theEmail";
$headers .= "\rReply-To: $theEmail";

$sentOk = mail($to,$subject,$message,$headers);

echo "sentOk=" . $sentOk;

?>

dcapdesign
08-06-2009, 06:44 AM
Hi so I to have been trying a few different tutorials and I feel my files are set up corrrectly but I am not getting anything to form or send to my email.
This is the As2 file of my swf

AS2 code:

var myData:LoadVars = new LoadVars();

send_bt.onRelease = function() {
if (boarData.boarName.text != "" && boarData.boarComments.text != "" && boarData.boarEmail.text != "") {
myData.boarName = boarData.boarName.text;
myData.boarComments = boarData.boarComments.text;
myData.boarEmail = boarData.boarEmail.text;
myData.sendAndLoad("http://www.mydomain.com/send.php",myData,"POST");//php
}
};
myData.onLoad = function() {
if (this.sentOk) {
this.msg = "Submited data was saved. Thank You";
gotoAndStop(2);
} else {
this.msg = "Error in saving submitted data";
}
gotoAndStop(2);
};
stop();

PHP code:

<?PHP
include_once("mail2.php");
ini_set('SMTP', 'relay-hosting.secureserver.net');

//Capture data from $_POST array
$name = $_POST['boarName'];
$comments = $_POST['boarComments'];
$email = $_POST['boarEmail'];

$to = 'me@mydomain.com' . ', '; // note the comma


$subject = "Boar Tracker subscription";
$message = "Name: " .$name;
$message .= PHP_EOL . PHP_EOL ."Email: $email";
$message .= PHP_EOL . PHP_EOL ."Message: $comments";
$headers = "From: $email";
$headers .= "\rReply-To: $email";

$sentOk = mail($to,$subject,$message,$headers);

echo "sentOk=" . $sentOk;

?>

This php file is named send.php if that matters. I keep reading about the forms that come with your godaddy account but I opened them up and they are super confusing. Seriously I am so confused. Any Help would be greatly appreciated.

Thanks