Jump to content

form mailer installation and configuration on godaddy


Recommended Posts

   The disclaimer:

 

I am just hatched for php purposes, so be nice.  I have written some hex and binary, C++, and visual basic but not much.  My first attempt at php is a php form mailer script I am writing for a friend.

 

   The issue:

 

I am tempted to say godaddy is the only issue but that might be too harsh, so since I am new lets say I don't know enough to make the script I have written work.  After doing some research I have been using the PhpGuide and various forums to try to find out what mistakes I am making.

 

   What I know:

 

The godaddy provided gdform.php is not working for me unless I need to make modifications to it to get it to function.  The installation guidelines for a Windows server, like the godaddy one I am using, I have found led me to ask go daddy a bunch of questions, below, that they did not, would not, or could not answer.  The script I wrote is not working but it may be because I need to do some actual configuration/installation things on the godaddy hosted site, I don't know.  I have seen a ton of forum questions about problems with godaddy and php but most of them were at least two or three years old.  Neither I nor my friend have an email account with godaddy.

 

   The question:

 

Is there a place to find out what steps to take to get a php formmailer working on godaddy?  Can it be made to work or is there a better way to get a simple form mail function working on godaddy?

 

   The script in question:

I know it is off in places but the functionality is the important thing right now.

 

<?php

//

//version 1.0 this is hopefully commented out through the use of forward slash and hard returns

//

$name = $_REQUEST['name'] ;

$address = $_REQUEST['address'] ;

$city = $_REQUEST['city'] ;

$state = $_REQUEST['state'] ;

$zip code = $_REQUEST['zip code'] ;

$phone number = $_REQUEST['phone number'] ;

$email = $_REQUEST['email'] ;

if ( preg_match( "/[\r\n]/", $name ) || preg_match( "/[\r\n]/", $email ) ) {

[... direct user to an error page and quit ...] }

$current loan balance = $_REQUEST['current loan balance'] ;

$current interest rate = $_REQUEST['current interest rate'] ;

$number of years remaining on loan = $_REQUEST['number of years remaining on loan'] ;

$current bank-company = $_REQUEST['current bank-company'] ;

$market value of home = $_REQUEST['market value of home'] ;

$your credit score = $_REQUEST['your credit score'] ;

mail ( "leaderdb8@hotmail.com", "Feedback Form Results",

$message, "From: $name" ) ;

//

// The double forward slash goal is to comment out the following notes and for documentation hopefully it worked

//

//

// Hope springs eternal did I comment this out questionmark I hope so because we dont have a thank you page

//header ( "Location: http://www.example.com/thankyou.html" ) ;

//

?>

 

   The questions asked of godaddy:   (the response seemed to have nothing to do with the questions, it was something about .asp on Linux)

 

Is FastCGI enabled?

Is the handler mapping created & setup?

Is FastCGI impersonation enabled?

Is index.php set as a default document in IIS?

 

   The finale:

 

If anyone can provide me with any help it would be greatly appreciated.  Thank You for taking a look.

Link to comment
Share on other sites

One of the most common issues with sending emails from PHP is the use of the "From:" header. This header must be a valid email address that has authority to send emails from the SMTP server being used. You are assigning the "Name" field from the form, which is apparently the user's real-world name. This is not going to work.

 

I have never used GoDaddy, but I believe you get at least one email address with the hosting service. If godaddy is providing an SMTP server (or sendmail executable), then that address is the one you should use. If you have configured PHP to use a different SMTP server, then you need to use your email address on that server.

 

If you want the user-supplied email address in the message so you can reply to them. You add a "Reply-To:" header with their address.

 

There are some other issues with that script:

1) if ( preg_match( "/[\r\n]/", $name ) || preg_match( "/[\r\n]/", $email ) ) {

[... direct user to an error page and quit ...] } is not valid code and should be causing an error. It may even prevent the script from executing at all.

2) You never did assign anything to the $message variable so the email is going to be empty

3) You never output anything and you don't redirect, so even if the script works, the user will be left with a blank white page. At the very least do something like this:

if (mail( ... )) {
  echo 'Email Sent.<BR>' . $message;
} else {
  echo 'Email Failed';
}
4) Turn on error reporting in development so you can see any errors that occur. Put these lines at the beginning of the script:

error_reporting(-1);
ini_set('display.errors', 1);
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.