Problem with mail()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
countrydj
Forum Newbie
Posts: 5
Joined: Thu Oct 27, 2011 6:51 pm

Problem with mail()

Post by countrydj »

Hi Guys...

I have a problem that I just done understand.
This is the code that I am using:

Code: Select all

	# SEND EMAIL

//	$to      = 'ann@in-uk.co.uk';
	$to      = 'dave@swarbrick-racing.co.uk';
	$subject = "Web site Enquiry";

	$headers = "From: $email ($name)\r\n";
	$headers .= "Bcc: jc@ukzone.com\r\n";
   	$headers .="Reply-To: $name <$email>\r\n";
   	$headers .="X-Mailer: PHP/ . phpversion()";

	$messages = "Message from:  $name ($email) on $date_time\n\n";
	$messages .= "-----------------------------------------------------------------------------------------------------------------------------------\n\n";
	$messages .= "Remote IP: $remote_ip\n";
	$messages .= "Referer: $referer\n\n";
	$messages .= "Name: $name\n\n";
	$messages .= "Country: $country\n\n";
	$messages .= "Selection: $selection\n\n";
	$messages .= "Message:\n";
	$messages .= "$message\n\n";
	$messages .= "-----------------------------------------------------------------------------------------------------------------------------------\n\n";
	$messages .= "HTTP_USER_AGENT: $client\n\n";
mail($to, $subject, $messages, $headers);
The problem that I have is that the code will send Bcc when I have the main recipient as:

Code: Select all

$to      = 'dave@swarbrick-racing.co.uk';
but it will NOT send Bcc when the main recipient is:

Code: Select all

$to      = 'ann@in-uk.co.uk';
Has anybody got any ideas why this should happen ???

Any suggestions will be welcome.

John C
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Problem with mail()

Post by Jade »

Is that even a valid email address? Also I would check to make sure it's not being caught by a spam filter and that the email address is accepting ANY email. Sometimes it can also have to do with the email server blacklisting your IP.
Post Reply