Page 1 of 1

Problems sending email using mail() function

Posted: Thu Jun 16, 2005 12:39 am
by beno747
Hi Team,

I am having problems sending email from a website that I have created.

If I send the email to someone at the same domain the website has then it will not send.

If I send the email to anyone at a different domain then it works fine but for some weird reason not when I send to the same domain. I'll give you the code to have a squiz at.

Code: Select all

$message = "TEST";	
	$from = "Ben";
       $subject = "Subject";
	$to ="domain@domain.com"; // Lets just pretend that domain.com is the name of the website
	
	// Mail it
	
	$mail_success = mail($to, $subject, $message, $from);
	
	if ($mail_success == true) 
	{
		header("location:contactthanks.php");
		exit();
	} 
	
	else 
	{	
		header("location:contacterror.php?error=error+sending+email");
		exit();			
	}
If someone could help me out then I would be much appreciated.

d11wtq | Please use

Code: Select all

tags when posting PHP code[/color]

Posted: Thu Jun 16, 2005 1:45 am
by Syranide
if it is using a local SMTP it might be that it hasn't been configured for translating its name to local addresses, try sending the mail to the local IP address, should work if that's the problem.

otherwise it could be some spamfilter I guess.