Jump to content

Emails not sending with form submission


kobryan

Recommended Posts

I have used this for a while until recently i added the second email address to the form. For some reason it is not sending the emails after the addition. I wanted to make sure this is not a problem with my coding before i went to my server company and checked with them. thanks for any help.

<?php
	$form = "<form action='contact.php' method='post'>
	<table>
	<tr>
		<td></td>
		<td><font color='red'>*</font> are required</td>
	</tr>
	<tr>
		<td>Full Name:</td>
		<td><input type='text' name='fullname' class='textbox' size='56px'><font color='red'>*</font></td>
	</tr>
	<tr>
		<td>Phone:</td>
		<td><input type='text' name='phone' class='textbox' size='56px'><font color='red'>*</font></td>
	</tr>
	<tr>
		<td>City:</td>
		<td><input type='text' name='city' class='textbox' size='56px'><font color='red'>*</font></td>
	</tr>
	<tr>
		<td>Email:</td>
		<td><input type='text' name='email' class='textbox' size='56px'><font color='red'>*</font></td>
	</tr>
	<tr>
		<td>Questions/Comments:</td>
		<td><textarea type='text' name='comment' class='textbox' rows='7' cols='43'></textarea><font color='red'>*</font></td>
	</tr>
	<tr>
		<td></td>
		<td><input type='submit' name='submitbtn' class='button' value='Submit'></td>
	</tr>
	</table>
	</form>";
	
	if ($_POST['submitbtn']){
		$fullname = $_POST['fullname'];
		$email = $_POST['email'];
		$comment = $_POST['comment'];
		$phone = $_POST['phone'];
		$city = $_POST['city'];
		
		
		if ($fullname && $phone && city && $email && $comment){
		
			if (strstr($email, "@") && strstr($email, ".") && (strlen($email) >= 6)){
			
				mysql_query("INSERT INTO contact VALUES ('', '$fullname', '$phone', '$city', '$email', '$comment', NOW())");
			
				$webmaster = "xxx@xxx.com, xxx@xxx.com";
				$headers = "From: $fullname<$email>";
				$subject = "Contact Us Form from $fullname";
				$message = "$fullname\r\n$phone\r\n$city\r\n$email\r\n$comment";
				
				mail ($webmaster, $subject, $message, $headers);
				
				echo "Your message has been sent. $form";
				
			}
			else
				echo"Please enter a valid email address. $form";
		}
		else
			echo "You did not enter all required information. $form";
		
	}
	else
		echo "$form";
	
	?>
Link to comment
Share on other sites

what second email address in the form? i only see one.

$webmaster = "#1 xxx@xxx.com, #2 xxx@xxx.com";

Im sorry i must of used incorrect terms. The submission email that is going to me and my partner when i added my partners email address in the $webmaster section seemed to stop sending them all together. My DB still gets every submission. 

Link to comment
Share on other sites

are the domains, the @xxx.com, in both of the email addresses the same?

 

anyway, you are probably triggering some relaying restrictions on your mail server. what if any php errors do you get when you add the following two lines of php code into your program -

ini_set("display_errors", "1");
error_reporting(-1);
Link to comment
Share on other sites

 

are the domains, the @xxx.com, in both of the email addresses the same?

 

anyway, you are probably triggering some relaying restrictions on your mail server. what if any php errors do you get when you add the following two lines of php code into your program -

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

They are the same domain name in both email addresses.

 

I added the code but no errors appeared and the code seemed to start working again does that mean it was server side or is what you had me add what fixed it? I'm getting no PHP errors in my error log or on the page with this code since it seems like this is supposed to show the errors on the screen. 

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.