Email script does not send email

Hey,

Can anyone help me find out why this code does not send an email, i get no errors but the email just does not send, do you think there is an error somewhere?


	if(isset($_POST['tick'])){
		$tick = "No";
	} else {
		$tick = "Yes";
	}
		
// Send email to info @ 		
		$msg = "<h3>New Member Registration</h3>
					<table>        
				        <tr>
				        	<td>Name:</td><td>".$_POST['name']."</td></tr>
				        <tr>
				        	<td>Address 1:</td><td>".$_POST['address_1']."</td>
				        </tr>     
				        <tr>
				        	<td>Address 2:</td><td>".$_POST['address_2']."</td>
				        </tr>     
				        <tr>
				        	<td>Postcode:</td><td>".$_POST['postcode']."</td>
				        </tr>     
				        <tr>
				        	<td>Email address:</td><td>".$_POST['email']."</td>
				        </tr>     
				        <tr>
				        	<td>Tel no - home:</td><td>".$_POST['tel_home']."</td>
				        </tr>     
				        <tr>
				        	<td>Tel no - work:</td><td>".$_POST['tel_work']."</td>
				        </tr>     
				        <tr>
				        	<td>Tel no - mobile:</td><td>".$_POST['tel_mobile']."</td>
				        </tr>     
				        <tr>
				        	<td>Date of Birth:</td><td>".$_POST['DOB']."</td>
				        </tr>     
		        		<tr>
		        			<td>Delivery date (if appropriate):</td><td>".$_POST['delivery']."</td></tr>     
					</table>
			
					<br/>
			
					<table>        
				        <tr>
				        	<td>Name of other adults:</td><td>Postcode</td>
				        </tr>     
				        <tr>
				        	<td>".$_POST['name_adult_1']."</td><td>".$_POST['adult_postcode_1']."</td>
				        </tr>     
				        <tr>
				        	<td>".$_POST['name_adult_2']."</td><td>".$_POST['adult_postcode_2']."</td></tr>     
					</table>
			
					<br/>
					
					<table>
				        <tr>
				        	<td>Name of child:</td><td>Date of Birth</td><td>Boy/Girl</td>
				        </tr>     
				        <tr>
				        	<td>".$_POST['name_child_1']."</td><td>".$_POST['child_dob_1']."</td><td>".$_POST['child_boy_1']."</td></tr>     
				        	<td>".$_POST['name_child_2']."</td><td>".$_POST['child_dob_2']."</td><td>".$_POST['child_boy_2']."</td></tr>     
				        	<td>".$_POST['name_child_3']."</td><td>".$_POST['child_dob_3']."</td><td>".$_POST['child_boy_3']."</td></tr>     
				        	<td>".$_POST['name_child_4']."</td><td>".$_POST['child_dob_4']."</td><td>".$_POST['child_boy_4']."</td></tr>     
				        	<td>".$_POST['name_child_5']."</td><td>".$_POST['child_dob_5']."</td><td>".$_POST['child_boy_5']."</td></tr>     
				        	<td>".$_POST['name_child_6']."</td><td>".$_POST['child_dob_6']."</td><td>".$_POST['child_boy_6']."</td></tr>     
					</table>
					
					<br/>
					
					<table>
		        		<tr>
		        			<td>Do any of the persons listed above have specific dietary requirements?</td><td>".$_POST['dietary']."</td>
		        		</tr>     
		       
					 <tr>
			        	<td>How did you hear about Glo Family</td>
			       		<td>".$_POST['hear']."</td>
			        </tr>     
				</table>
			
				<br/>
				
				<table>
					<tr>
			        	<td>How did you hear about Glo Family</td>
			       		<td>".$tick."</td>
	 		        </tr>
				</table>
					";
			$to = "ibrar@freemanholland.com";
			$from = "noreply@glofamily.com";
			$subject = "New registration Glo Family website";
			$headers  = "From: $from\\r\
";
			$headers .= "Content-type: text/html\\r\
";
		
			mail($to, $subject, $msg, $headers);

Can you see any problems above?

Thanks

Thanks ScallioXTX,

So how can i resolve this, the email is not spam by no means… The problem is that i don’t even receive the email in my Junk folder for @freemanholland.com

I really need to get this working, so is there a better method or something i can do to overcome this problem?

Thanks again…

It probably is sent to both addresses, but @freeemanholland.com sees it as spam, or there is some other configuration error somewhere.
The code seems fine to me (which is proven by the fact that you receive the e-mail in your @hotmail account).

Hey,

I am now using this code:


			$from = "dontreply@glofamily.com";
            $headers = "From: $from";
			$to = "ibrar@freemanholland.com";
			
			$subject = "New registration Glo Family website";
					
			//begin of HTML message
			    $message = <<<EOF
			<html>
			  <body>
				  <div style='background:#e1e1e1; padding:10px'>
						<h3>New Member Registration</h3>	
								        
				        <br>
				        
						<table>        
					        <tr>
					        	<td>Name:</td><td>$_POST[name]</td></tr>
					        <tr>
					        	<td>Address 1:</td><td>$_POST[address_1]</td>
					        </tr>     
					        <tr>
					        	<td>Address 2:</td><td>$_POST[address_2]</td>
					        </tr>     
					        <tr>
					        	<td>Postcode:</td><td>$_POST[postcode]</td>
					        </tr>     
					        <tr>
					        	<td>Email address:</td><td>$_POST[email]</td>
					        </tr>     
					        <tr>
					        	<td>Tel no - home:</td><td>$_POST[tel_home]</td>
					        </tr>     
					        <tr>
					        	<td>Tel no - work:</td><td>$_POST[tel_work]</td>
					        </tr>     
					        <tr>
					        	<td>Tel no - mobile:</td><td>$_POST[tel_mobile]</td>
					        </tr>     
					        <tr>
					        	<td>Date of Birth:</td><td>$_POST[DOB]</td>
					        </tr>     
			        		<tr>
			        			<td>Delivery date (if appropriate):</td><td>$_POST[delivery]</td></tr>     
						</table>
				
						<br/>
				
						<table>        
					        <tr>
					        	<td>Name of other adults:</td><td>Postcode</td>
					        </tr>     
</table>
					</div>	        
					<br>
					
			        <b>glofamily.com</b>
			        
			        <br><br>
			        
			        <i>p.s. please do not reply to this email.</i>
			  </body>
			</html>
EOF;
			   //end of message
			    $headers  = "From: $from\\r\
";
			    $headers .= "Content-type: text/html\\r\
";
			    $headers .= "Cc: ibrar_hussain_19@hotmail.co.uk";
				
			mail($to, $subject, $message, $headers);

Now the problem i am having is that emails are successfully being sent to my hotmail account, looking perfect. But the @freeemanholland.com account seems to be causing the issue…

How can i make sure this email is sent to both addresses?

Thanks…

can you try a basic


mail('ibrar@freemanholland.com', 'test', 'TEST');

and see if that works?
If it does the delivery is not the problem. If it doesn’t work there is some config error somewhere.

Hey,

It does work when i send to a normal account i.e my Hotmail.

So you think the best thing to would be to contact the hosting company?

Here goes a long phone call… :wink:

If the mail function returns true that does not mean the mail actually got delivered, it only means PHP could succesfully drop the mail off at the SMTP server.
Does it work when you e-mail them from a “normal” account, i.e. from your Hotmail?
To see where it goes wrong I’d e-mail the hoster with the question, or look at the e-mail logs of the server where the e-mail address is hosted.

Yup, that seems like the best thing to do imo.
A lot of things may be off, and they could probably walk you through it.
Good luck, and if they don’t help you (enough) feel free to come back here :slight_smile:

Hey,

I have just tried doing this:


		 <?
		 if(mail('ibrar@freemanholland.com', 'test', 'TEST')){
			echo 'Mail Sent!';		 
		 } else {
			echo 'Mail Not sent!';		 
		 } 
		 ?>

And i get “Mail Sent!”…

This is really weird, where could this config error be? How can i try fixing this?

Thanks