send mail help

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
bonanza
Forum Newbie
Posts: 7
Joined: Mon Apr 19, 2010 9:50 am

send mail help

Post by bonanza »

hi,
I have the following email script but it doesnt work can I have any help please

Code: Select all

 <form action="" method="post" name="form1" target="_parent">
            <br>
            <br>
            
  <div align="center">
  </div>
  <table width="378" border="0" align="center">
    <tr>
      <td>
        <div align="right">
          <input name="name" type="text" id="name">
      </div></td>
      <td width="161"><div align="left"><strong>:الإسم</strong></div></td>
    </tr>
    <tr>
      <td>
        <div align="right">
          <input name="email" type="text" id="email">
        </div></td>
      <td> <div align="left"><strong>:بريدك الألكتروني</strong></div></td>
    </tr>
    <tr>
      <td><div align="right">
          <input name="title" type="text" id="title">
      </div></td>
      <td><div align="left"><strong>:عنوان الرسالة </strong></div></td>
    </tr>
    <tr>
      <td>
        <div align="right">
          <textarea name="message" cols="30" rows="5" id="message"></textarea>
        </div></td>
      <td><div align="left"><strong>:نص الرسالة</strong></div></td>
    </tr>
    <tr>
      <td colspan="2"><div align="center"></div>        <div align="center">
        <input name="sendMSG" type="submit" id="sendMSG" value="أرسل الرسالة">      
      </div></td>
    </tr>
  </table>
  <?php
 if(isset($_POST['sendMSG']))
  {
	  	if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['title']) || empty($_POST['message']))
			echo "<center> <h3>الرجاء التأكد من تعبئة جميع الحقول</h3></center>";
		$to = $email2;
		$email = $_POST['email'] ; 
		$subject = $_POST['title'] ;
		$message = "FROM:" ;
		$message .= " ";
		$message .= $_POST['name'];
		$message .= "<br>";
		$message .= $_POST['message'] ;
		$headers = "From: $email"; 
		if( mail ($to, $subject, $message, $headers) )
			echo "<center> <h3>لقد تم إرسال رسالتك</h3></center>";
		else
			echo "<center> <h3>نأسف حدث خلل ما</center></h3>";
	}
?>
  </form>

where $email2 is an email saved in the database.

I resieve this error:

Warning: mail() [function.mail]: SMTP server response: 553 sorry, sender mail address must correspond to local mail domain (#5.7.1)

if any one can help I will appreciate it


thanks in advance.
Last edited by Benjamin on Thu May 20, 2010 2:50 am, edited 1 time in total.
Reason: Added [syntax=php] tags.
Post Reply