Jump to content

[SOLVED] Issue with AS3 Email Form and PHP timeout.


simplexian

Recommended Posts

I am using Flash CS3 (Actionscript 3.0) to create a contact form.

 

The problem in this case, is that the email is not being recieved for 10+ minutes. The browser hangs at "Transferring data from ...". With that said, the URLLoader does recieve the Event.COMPLETE, so the PHP file is recieving the variables from Flash correctly.

 

I am assuming this is a timeout issue of some sort, but I am not finding any answers on the Actionscript forums.

 

Here is the PHP file being used:

 

<?php

$name=$_POST['name'];
$email=$_POST['email'];
$message=$_POST['message'];
$subject = 'Subject example';
$toaddress='xxxxxxxx@xxx.com';
$name=trim($name);
$email=trim($email);
$subject=stripslashes($subject);
$message=stripslashes($message);
if(mail($toaddress,$subject,$message,'From: '.$name.' <'.$email.'>')){
echo 'response=passed';
} else {
echo 'response=failed';
}
?>

 

 

 

 

Link to comment
Share on other sites

It's not my mail server.

 

To test to make sure my mail server wasn't backed up in the queue, I had a friend send numerous emails before, during, and after the email sent by the contact form. All emails sent by the friend were recieved almost instantly, while the email from the contact form isn't recieved until the timeout on the PHP file.

Link to comment
Share on other sites

To test to make sure my mail server wasn't backed up in the queue, I had a friend send numerous emails before, during, and after the email sent by the contact form. All emails sent by the friend were recieved almost instantly, while the email from the contact form isn't recieved until the timeout on the PHP file.

 

I wasn't clear. The emails that were recieved instantly were not sent through the PHP file in question, they were sent through his mail provider.

 

Additionally... to ensure it isn't the fault of flash, I made an html file to send the email, and exactly the same problem. 10-15 minutes to recieve email.

 

Again, an email sent by either the html mail form or flash are not recieved until the timeout on the PHP file.

Link to comment
Share on other sites

then the only solution, is that your host, or your mail server (if your hosting on your own server) has a cron job, that checks every 10 minutes or so for new mail to be sent, then sends out the emails.

 

If you have sent mail out before, using the same mail server, has it been sent instantly before?

Link to comment
Share on other sites

In what code? The PHP?

 

<?php

$name=$_POST['name'];
$email=$_POST['email'];
$message=$_POST['message'];
$subject = 'Subject example';
$toaddress='xxxxxxxx@xxx.com';
$name=trim($name);
$email=trim($email);
$subject=stripslashes($subject);
$message=stripslashes($message);
if(mail($toaddress,$subject,$message,'From: '.$name.' <'.$email.'>')){
echo 'response=passed';
} else {
echo 'response=failed';
}
?>

 

No loop present.

 

And far as with set_time_limit, how do I implement that with the preceding code? I know nothing of PHP, obviously.

Link to comment
Share on other sites

set time limit may not be the problem, but it shouldn't hang forever.

set_time_limit(10);
$name=$_POST['name'];
$email=$_POST['email'];
$message=$_POST['message'];
$subject = 'Subject example';
$toaddress='xxxxxxxx@xxx.com';
$name=trim($name);
$email=trim($email);
$subject=stripslashes($subject);
$message=stripslashes($message);
if(mail($toaddress,$subject,$message,'From: '.$name.' <'.$email.'>')){
echo 'response=passed';
} else {
echo 'response=failed';
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.