PDA

View Full Version : Flash CS3 / PHP Custom Mailer...


asmithdesigns
10-30-2008, 10:25 PM
Hello all,

I will try and make this brief... been dealing with it for quite some time. Basically, I have a Flash movie that includes a text field and a submit button. The user will put in their e-mail address and then click submit... which will send them an e-mail.

Everything works fine on bluehost.com. However, my client needs it to work on godaddy.com. I have found one interesting thing that might help some of you with this!

Here is the line of code that is attached to my button in flash..


on (release) {
form.loadVariables("Pricing_Texts/My_Heaven_Hell_PRICING.php", "POST");
}


Here is the PHP file that it is calling...


<?php

include_once("Mail.php");

$to = $HTTP_POST_VARS['email'];
$subject = "Requested Pricing";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Todd White <pricing@artofwhitegallery.com>' . "\r\n";
$headers .= 'Cc: ' . "\r\n";
$message = "Thank you for your interest! Here is the pricing you requested:

My Heavan & Hell - $1500.00

Please feel free to contact us at 317-379-6340 with any questions!";

if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $to)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}

elseif (mail($to,$subject,$message,$headers)) {
echo "<h4>Thank you for sending email</h4>";
} else {
echo "<h4>Can't send email to $to</h4>";
}

?>


Now, the most interesting thing is this...

When I replace


$to = $HTTP_POST_VARS['email'];


with


$to = "asmithdesigns@gmail.com";


the works great with godaddy.com. However, when I try and do it the original way... it always shoots back Invalid E-Mail Address.

Like I said before, I know that my original coding works 100% since I have it running on bluehost. It is just that my client needs it working through godaddy.

I have already made sure that I am using Linux hosting on both goddady and bluehost. They are both capable of running the most current versions of php as well.

Does anyone have any ideas?? I am desperate!!

Thanks for your time and concern,

.: andrew

bowljoman
10-31-2008, 05:53 PM
Use
$_POST['email']

I'd also use URLRequest and URLRequestVariables but thats just my style.

asmithdesigns
11-01-2008, 05:10 PM
Thank you for the reply!

I have actually tried that already... with no luck.

Someone on another forum seemed to think that Flash was not giving a valid e-mail address. It is giving back pre-formatted HTML in flash.... with the e-mail address that is entered someone in the mix.

Here is an example of what Flash is sending to my PHP Script...

email=<TEXTFORMAT LEADING="2"><P ... more html stuff>email address here </FONT></TEXTFORMAT>

It turns out that GoDaddy cannot interpret that coding and disgards it. However, Bluehost has a way of picking out the e-mail address and allowing my script to send it.

Does anyone know a way to alter the actionscript I have on my Flash button to avoid this?

Thanks!

bowljoman
11-04-2008, 12:30 AM
var url:String = "http://www.[yourDomain].com/[yourscript].php";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.email="someone@somewhere.com";
request.data=variables;
request.method="post";

navigateToURL(request);

asmithdesigns
11-07-2008, 12:58 AM
Thanks for the info!!

I am just curious as to what would be going in the variables.email. Is that the address of who the e-mail is coming from?

Also, I am a little bit of a novice with the script you have written. Could anyone help me understand what it is doing?

Thanks!!!