Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can mail sender and recipient be identical?

Status
Not open for further replies.

frozenpeas

Technical User
Joined
Sep 13, 2001
Messages
893
Location
CA
When I use a PHP script to send email, it works unless the sender and recipient are identical. Is this normal?

Thanks.

frozenpeas
 
Linux, Apache, Sendmail. Unfortunately I cannot give you much more detail because I do not run my own server.

frozenpeas
 
Code:
$sender = $_SESSION['uname'];
$query = mysql_query("SELECT * FROM admin WHERE username = '$sender'") or die ('Could not query database: '.mysql_error());
while ($row = mysql_fetch_array($query)){
$header = &quot;From: &quot;.$row['name'].&quot;<&quot;.$row['email'].&quot;>&quot;.&quot;\r\n&quot;
		  .&quot;Reply-To: &quot;.$row['email'].&quot;\r\n&quot;
  		  .&quot;\&quot;MIME-Version: 1.0\&quot;\r\n&quot;
		  .&quot;Content-Type: text/plain;&quot;; 
$boundary = uniqid(&quot;EMAIL&quot;);
$toaddress = $_POST['select'];
$subject = $subject;
$mailcontent = $message
			   .&quot;\n&quot;.'--'.&quot;\n&quot;
			   .'This message was submitted by '.$_SESSION['uname'].' from '.$REMOTE_ADDR.'.&quot;\n&quot;;
mail($toaddress, $subject, $mailcontent, $header);
}

frozenpeas
 
It must be your MTA. My LAMP box is running postfix, and I don't have that problem, even when running a modified version of the code you've posted.

Since I'm out of ideas, you might try contacting your service provider and ask them about the problem. It may be they have configured sendmail to not allow users to send mail to themselves.

Want the best answers? Ask the best questions: TANSTAAFL!
 
Strange. Thanks for your help - I'll see what they have to say.

frozenpeas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top