aled Posted February 12, 2008 Share Posted February 12, 2008 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>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/90624-email-form-works-on-windows-server-not-on-linux/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.