|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi guys, I just signed up with a new dedicated server and have been testing a few things. Everything works great except for my email forms. Now the site is still just an ip address at this point with no domain name associated to it, would this cause an email not to be sent?
Basically I have a form that POST's to the page form_process.php that I have included below... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="language" content="en-us"> <title></title> <link href="css/fonts.css" rel="stylesheet" type="text/css"> <link href="css/tabs.css" rel="stylesheet" type="text/css"> <link href="css/menu.css" rel="stylesheet" type="text/css"> <script language="javascript" src="js/google.js"></script> </head> <? //require_once("db.php"); //session_start(); // Define post fields into simple variables $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $title = $_POST['title']; $company = $_POST['company']; $phone = $_POST['phone']; $fax = $_POST['fax']; $email = $_POST['email']; $address = $_POST['address']; $address1 = $_POST['address1']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $country = $_POST['country']; $companydo =$_POST['companydo']; $productsinterest =$_POST['productsinterest']; $application =$_POST['application']; $questions =$_POST['questions']; $referredfrom =$_POST['referredfrom']; $request1 =$_POST['request1']; $request2 =$_POST['request2']; $request3 =$_POST['request3']; $specify =$_POST['specify']; /* Let's strip some slashes in case the user entered any escaped characters. */ $email = stripslashes($email); $first_name = stripslashes($first_name); $last_name = stripslashes($last_name); $address = stripslashes($address); $address1 = stripslashes($address1); $city = stripslashes($city); $zip = stripslashes($zip); $phone = stripslashes($phone); $fax = stripslashes($fax); /* Lets clean up the phone number fields */ $phone = ereg_replace("[)(.-]","",$phone); $fax = ereg_replace("[)(.-]","",$fax); /* Do some error checking on the form posted fields */ if((!$request1) && (!$request2) && (!$request3) || (!$first_name) || (!$last_name) || (!$title) || (!$company) || (!$phone) || (!$email) || (!$address) || (!$city) || (!$state) || (!$zip) || (!$country) || (!$referredfrom) || (!$specify)){ ?> <table width="900" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td height="88" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <?php include('header.php'); ?> </table> </td> </tr> <tr> <td width="158" height="956" valign="top" class="border_right"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top"></td></tr> <tr> <td valign="top"><?php include('sideleft.php'); ?></td></tr> </table></td> <td width="742" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <? echo ' '; echo ' '; echo "<SPAN class='content'>"; echo "<center />"; echo '<font color="#FF0000"> You did not submit the following required information!</font> '; if(!$request1 && !$request2 && !$request3){ echo "Choose one or more of the following: Product Information, a Product Catalog or Sign Up for our Newsletter. Please click the BACK button. "; } if(!$first_name){ echo "Your First Name is a required field. Please click the BACK button. "; } if(!$last_name){ echo "Your Last Name is a required field. Please click the BACK button. "; } if(!$title){ echo "Your Job Title is a required field. Please click the BACK button. "; } if(!$company){ echo "Your Company Name is a required field. Please click the BACK button. "; } if(!$phone){ echo "Phone Number is a required field. Please click the BACK button. "; } if(!$email){ echo "Email Address is a required field.Please click the BACK button. "; } if(!$address){ echo "Address is a required field. Please click the BACK button. "; } if(!$city){ echo "City is a required field. Please click the BACK button. "; } if(!$state){ echo "State is a required field. Please click the BACK button. "; } if(!$zip){ echo "Zip Code is a required field. Please click the BACK button. "; } if(!$country){ echo "Country is a required field. Please click the BACK button. "; } if(!$referredfrom){ echo "How did you hear about Omnitron is a required field. Please click the BACK button. "; } if(!$specify){ echo "Please Specify where heard about Omnitron is a required field. Please click the BACK button. "; } echo '</span>'; echo '<tr /><td width="846" height="624"></td></tr></table></td></tr>'; echo '<tr /><td height="90" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">'; include('footer.php'); echo '</table></td></tr></table>'; /* End the error checking and if everything is ok, we'll move on to creating the user account */ exit(); // if the error checking has failed, we'll exit the script! }; $toaddress = "me@mydomain.com"; // Let's mail the user! $subject = "A Web Site Visitor has Requested the following: $request1 $request2 $request3"; $message = " A web site visitor has requested the following: $request1 $request2 $request3 First Name: $first_name Last Name: $last_name Company: $company Title: $title Address: $address Address Cont.: $address1 City: $city State: $state Zip: $zip Country: $country Phone: $phone Fax Phone: $fax Email: $email What does your company do? $companydo What products are you interested in? $productsinterest What is your application? What type of network do you have? $application If you have any question for our product specialists, please enter in the space below: $questions Heard of us from - $referredfrom Specifics: $specify This is an inter office email only, please do not reply! "; mail($toaddress, $subject, $message, "From: My Company Request<marketing@mydomain.com>"); ?> <table width="900" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td height="88" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <?php include('header.php'); ?> </table> </td> </tr> <tr> <td width="158" height="956" valign="top" class="border_right"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top"></td></tr> <tr> <td valign="top"><?php include('sideleft.php'); ?></td></tr> </table></td> <td width="742" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <? echo ' '; echo ' '; echo "<SPAN class='content'>"; echo "<center />"; echo 'Thank you for filling out our form.'; echo ' '; echo ' <a href=index.php>Return To Homepage</a>'; echo ' '; echo '<center><hr width="500" /></center>'; echo '</span>'; echo '<tr /><td width="846" height="624"></td></tr></table></td></tr>'; echo '<tr /><td height="90" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">'; include('footer.php'); echo '</table></td></tr></table>'; // Result Page to let User Know that they've been accepted in to the site ?> Obviously I've replaced my real email address above , but you get the idea. So anyway this script seems to work OK for error checking, and when all the fields on the form are filled I get a nice "your email has been sent" message. But I never receive the email! My old server is IIS and my new one is Linux, so I'm not sure if there is some sort of configuration that I'm missing. Any ideas? |
|
|||
|
Did you can check the (apache) error_log or maillog for any hints?
This may sound strange.. but try putting the "From" information into a variable as well. The format I use is something like: $mailer = mail($to, $subject, $message, $headers);
__________________
Hardcore Programming Solutions and Coffee Drinker |
|
|||
|
thanks for the response guys. I have a Plesk control panel on my dedicated server so I'm not really sure how to check error logs or how to find the .ini file you spoke of. How would I go about doing this?
|
|
|||
|
You will need to log into shell in order to see php.ini and other config files.
Also, php tends to send out mail as "nobody", so if you have it blocked or turned off, it won't send either |
|
|||
|
If the server is 'just an IP address' at the moment, then I assume you haven't yet setup any domains on it.
Your mailserver *should* have been setup by your ISP to not be an open relay. This is accomplished by only accepting SMTP email addressed to domains that exist on the server. i.e. it wont accept smtp emails that are addressed to recipients who dont exist on your server. Since you have no domains on the server at the moment, all email you try to send through your SMTP server will be viewed as a relay attempt, and subsequently dropped. The easiest and quickest way to test this is to telnet into the server at port 25 and try and send a mail manually. Any relay attempts should be reported as such. colr__ |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |