I want make an email script for users to be able to send me messages
and i getting Mail delivery failed: returning message to sender

this is the script

<ul>  
<li><form name="mail" method="POST"  
action="send_mail.php"></li>  
<li>To:</li>  
<li><input type="text" name="to"  
/></li>  
<li>Message:</li>  
<li><input type="text" name="Message"  
/></li>  
<li>From:</li>  
<li><input type="text" name="from"  
/></li>  
<li>CC:</li>  
<li><input type="text" name="cc"  
/></li>  
<li>&nbsp;</li>  
<li><input type="submit" name="submit"  
value="Send"/></li>  
<li>&nbsp;</li>  
</form>  
</ul> 

and the send_main.php

<?php  
  $to = $_POST['to'] ;      
  $message = $_POST['Message'] ;  
  $from = $_POST['from'];  
  $cc = $_POST['cc'];  
  $headers =  "From: ".$_POST['from']."\r\n" .  
"CC: ".$_POST['cc'];  
  mail( $to, "Mail", $message, $headers);  
?>

Recommended Answers

All 2 Replies

Do you know what the returned message states? I see you have specified a From address in the script so the bounce would be returned there.

thanks man i did it. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.