Jump to content

email form - works on windows server - not on linux


aled

Recommended Posts

I have created an email form which works on a windows platform - however i cannot make it work on a linux server. The php must be executing because it redirects to the thankyou.htm page (which I did using a header:location). However - the email is not reaching it's target:

 

Linux Server details:

 

SMTP: localhost

sendmail_from: no value

sendmail_path: /usr/sbin/sendmail -t -i

register_globals: off

 

CODE FOR XHTML and PHP (contactemailform.php) below:

 

XHTML CODE:

 

<form id="form" class="contact_form" method="post" action="contactemailform.php" onsubmit="return validate_form(this);">

<p>

email: (this bit must be filled in)

<br />

<input name="email" type="text" class="input" />

<br />

name:<br /> <input name="subject" type="text" class="input" />

<br />

telephone:

<br />

<input name="telephone" type="text" class="input" />

<br />

message:

<br />

<textarea name="message" rows="7" cols="30" class="input"></textarea>

<br />

<br />

<input type="submit" class="submit" value="submit email" />

</p>

</form>

 

PHP CODE

 

<?php

function spamcheck($field)

  {

//eregi() performs a case insensitive regular expression match

  if(eregi("to:",$field) || eregi("cc:",$field))

    {

    return TRUE;

    }

  else

    {

    return FALSE;

    }

  }//if "email" is filled out, send email

if (isset($_REQUEST['email']))

  {

  //check if the email address is invalid

  $mailcheck = spamcheck($_REQUEST['email']);

  if ($mailcheck==TRUE)

    {

    echo "Invalid input";

    }

  else

    {

    //send email

    $email = $_REQUEST['email'] ;

    $subject = $_REQUEST['subject'] ;

    $message = $_REQUEST['message'] ;

    ini_set("sendmail_path", "/usr/sbin/sendmail -t -i");

    mail("hello@dinky-diggers.com", "Subject: $subject",

    $message, "From: $email" );

    header( "Location: http://www.dinky-diggers.com/thankyou.htm" );}

  }

else

//if "email" is not filled out, display the form

  {

  echo "<form method='post' action='mailform.php'>

  Email: <input name='email' type='text' /><br />

  Subject: <input name='subject' type='text' /><br />

  Message:<br />

  <textarea name='message' rows='15' cols='40'>

  </textarea><br />

  <input type='submit' />

  </form>";

  }

?>

 

 

 

 

 

 

 

 

 

 

 

 

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.