Jump to content

Recommended Posts

This is my first post, so let me first say 'hello'.

 

I have written a simple form handler which works on my testing server; when I deploy to my client's GoDaddy server the message fails.

 

I have contacted GoDaddy's support and have been told the following:

 

"If you use the mail() function in your PHP, you do not need to specify an outgoing mail server. If you are using some other method besides mail() in your PHP code, use relay-hosting.secureserver.net for your relay server."

 

I DO use the mail() function and do not specify an outgoing mail server...the following is my code:

 

<?php

$contact_name = $_POST['name'];
$contact_email = $_POST['email'];
$contact_phone = $_POST['phone'];
$contact_message = $_POST['message'];

if( $contact_name == true )
{
$sender = $contact_email;
$receiver = "me@somewhere.com";
$phone = $contact_phone;
$receiver2 = $contact_email;
$client_ip = $_SERVER['REMOTE_ADDR'];
$email_body = "Name: $contact_name \nEmail: $sender \n\nPhone:  $phone\n\nMessage: \n\n$contact_message \n\nIP: $client_ip \n\n";




if( mail( $receiver, "Contacted via Web Site - $contact_subject", $email_body ))  
{
	echo "success=yes";
}
else
{
	echo "success=no";
}
}
?>

 

Any idea on what I am missing??

Link to comment
https://forums.phpfreaks.com/topic/194725-form-handler/
Share on other sites

Thank you for catching the subject issue.  *this issue resolved.

 

The message still fails.

 

I have written my form in ActionScript 3, not HTML.  The following is my AS:

 

function sendText (event:MouseEvent):void
{
	if( inputName.text == "" || inputEmail.text == "" || inputPhone.text == "" || inputMessage.text == "")
		{
			statusText.text = "Please fill in all text fields.";
		}
	else if( !validate_email(inputEmail.text) )
		{
			statusText.text = "Email not valid.";
		}
	else
		{
			statusText.text = "sending...";

			var email_data:String = "name=" + inputName.text
					   + "&email=" + inputEmail.text
					   + "&phone=" + inputPhone.text
					   + "&message=" + inputMessage.text;
					   
			var URL_vars:URLVariables = new URLVariables(email_data);
			URL_vars.dataFormat = URLLoaderDataFormat.TEXT;

			URL_request.data = URL_vars;
			var_load.load( URL_request );
			var_load.addEventListener(Event.COMPLETE, receive_response );
		}
}


function receive_response(e:Event):void
{
var loader:URLLoader = URLLoader(e.target);
        var email_status = new URLVariables(loader.data).success;

if( email_status == "yes" )
{
	statusText.text = "Your message was sent.";
	timer = new Timer(500);
	timer.addEventListener(TimerEvent.TIMER, on_timer);
	timer.start();
}
else
{
	statusText.text = "Message Failed!";
}
}

 

I'm officially stumped.  I have been on this one issue now for just over four hours.  :'(

 

All I get in response when testing is "Message Failed."

 

*maybe I should just change my message status  :D

Link to comment
https://forums.phpfreaks.com/topic/194725-form-handler/#findComment-1024035
Share on other sites

function sendText (event:MouseEvent):void
{
	if( inputName.text == "" || inputEmail.text == "" || inputPhone.text == "" || inputMessage.text == "")
		{
			statusText.text = "Please fill in all text fields.";
		}
	else if( !validate_email(inputEmail.text) )
		{
			statusText.text = "Email not valid.";
		}
	else
		{
			statusText.text = "sending...";

			var email_data:String = "name=" + inputName.text
					   + "&email=" + inputEmail.text
					   + "&phone=" + inputPhone.text
					   + "&message=" + inputMessage.text;
					   
			var URL_vars:URLVariables = new URLVariables(email_data);
			URL_vars.dataFormat = URLLoaderDataFormat.TEXT;

			URL_request.data = URL_vars;
			var_load.load( URL_request );
			var_load.addEventListener(Event.COMPLETE, receive_response );
		}
}


function receive_response(e:Event):void
{
var loader:URLLoader = URLLoader(e.target);
        var email_status = new URLVariables(loader.data).success;

if( email_status == "yes" )
{
	statusText.text = "Your message was sent.";
	timer = new Timer(500);
	timer.addEventListener(TimerEvent.TIMER, on_timer);
	timer.start();
}
else
{
	statusText.text = "Message Failed!";
}
}

 

 

I don't see a single part in this script where it is sending the collected data to an "se.php".

Link to comment
https://forums.phpfreaks.com/topic/194725-form-handler/#findComment-1024043
Share on other sites

You are right, the following is listed higher up in my AS code:

 

var var_load:URLLoader = new URLLoader;
var URL_request:URLRequest = new URLRequest( "se.php" );
URL_request.method = URLRequestMethod.POST;

 

var request:URLRequest = new URLRequest("http://www.yourserver.com/se.php");
request.method = URLRequestMethod.GET;

Link to comment
https://forums.phpfreaks.com/topic/194725-form-handler/#findComment-1024047
Share on other sites

Thank you for your help.

 

Question:  When they tell me:

 

"If you use the mail() function in your PHP, you do not need to specify an outgoing mail server. If you are using some other method besides mail() in your PHP code, use relay-hosting.secureserver.net  for your relay server."

 

where in the PHP file would I declare the relay-hosting?

Link to comment
https://forums.phpfreaks.com/topic/194725-form-handler/#findComment-1024050
Share on other sites

For debugging purposes, add the following two lines of php code immediately after your first opening <?php tag to get php to show all the errors it detects -

 

ini_set("display_errors", "1");
error_reporting(E_ALL);

 

I have done this and run my form.  When I look into the error logs, I don't see one of recent time stamp.  They are compressed and time stamped...latest one is 7-something PM EST.

Link to comment
https://forums.phpfreaks.com/topic/194725-form-handler/#findComment-1024052
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.