943,632 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 993
  • PHP RSS
Aug 15th, 2008
0

need help in send and email

Expand Post »
Quote ...
hi all;
suposed to be this question has been solve, perhaps sory if i need to ask again.

I found a code of send and email using with php classes; but there is something wrong with it.
here is the whole code.
class request {
    
	var $email;
	var $senderName;
	var $senderPhone;
	var $senderEmail;
    var $senderSubject;
    var $senderMessage;
    var $returnEmail;
    var $header;
    var $type         = "text/plain";
    var $characterSet = "iso-8859-1";
	
	function createHeader() {
	
        $from   = "From: $this->senderName <$this->senderEmail>\r\n";
        $returnEmail = "Reply-To: $this->returnEmail\r\n";    
        $params = "MIME-Version: 1.0\r\n";
        $params .= "Content-type: $this->type; charset=$this->characterSet\r\n";
        
        $this->header = $from.$returnEmail.$params;
        return $this->header;
    }
	
	function sendEmail(){

        $this->createHeader();
		
        @mail($this->email,$this->senderSubject,$this->senderMessage,$this->header);
 
    }

}

      $mail = new request();
        
      $mail->email          = $_POST['email'];
      $mail->senderName   	= $_POST['senderName'];
      $mail->senderEmail  	= $_POST['senderEmail'];
      $mail->senderPhone 	= $_POST['senderPhone'];
      $mail->senderSubject  = $_POST['senderSubject'];
      $mail->senderMessage  = $_POST['senderMessage'];
	  
      if ($mail->sendEmail()) {
	  
        echo "Thanks for your message!";

      } else {
        echo "Sending email was failed!";
      }

when i run this code. there is an error on the screen,
Quote ...
Warning: mail() [function.mail]: SMTP server response: 503 valid RCPT command must precede DATA in F:\Program Files
please help me to fixed this error. regards to all,
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
god_1896 is offline Offline
39 posts
since Jul 2008
Aug 15th, 2008
0

Re: need help in send and email

Before taking a deeper look, it appears that there's been a mixup of PHP and JavaScript variable types ... fix this first and if it still doesn't work let us know.

PHP Syntax (Toggle Plain Text)
  1. var $email;
  2. var $senderName;
  3. var $senderPhone;
  4. var $senderEmail;
  5. var $senderSubject;
  6. var $senderMessage;
  7. var $returnEmail;
  8. var $header;
  9. var $type = "text/plain";
  10. var $characterSet = "iso-8859-1";
... should be ...
PHP Syntax (Toggle Plain Text)
  1. $email;
  2. $senderName;
  3. $senderPhone;
  4. $senderEmail;
  5. $senderSubject;
  6. $senderMessage;
  7. $returnEmail;
  8. $header;
  9. $type = "text/plain";
  10. $characterSet = "iso-8859-1";
... since you don't use the var keyword to initialize variables in PHP

Hope this helps, let us know
Reputation Points: 30
Solved Threads: 36
Posting Whiz
langsor is offline Offline
389 posts
since Aug 2008
Aug 15th, 2008
0

Re: need help in send and email

hi, well i found somthing difference, this is more getting worry of me.
Reputation Points: 10
Solved Threads: 0
Light Poster
god_1896 is offline Offline
39 posts
since Jul 2008
Aug 15th, 2008
0

Re: need help in send and email

I'm providing a lot of wrong information today, I guess I should shut it down for the night.

But first I did a little investigation into your problem -- and I guess you do use the var keyword in pre-PHP5 class definitions (my bad) -- but to answer your question, many mail systems require you to receive email through the system before you can send mail through the system ... this is to prevent people using the system to relay SPAM and related activities.

Looks like your error message is coming from the mail server and not PHP directly, and that the above issue is your problem.

So do a "receive" before trying to "send" with your mail server and see if that fixes the problem.

Hope this helps
Reputation Points: 30
Solved Threads: 36
Posting Whiz
langsor is offline Offline
389 posts
since Aug 2008
Aug 15th, 2008
0

Re: need help in send and email

hi; yes maybe your right;

but i finally solve this problem. actually its my mistake, I forgot to post the default email of the reciepient. Im sory
Reputation Points: 10
Solved Threads: 0
Light Poster
god_1896 is offline Offline
39 posts
since Jul 2008
Aug 15th, 2008
0

Re: need help in send and email

No worries, glad you got it figured out.

:-)
Reputation Points: 30
Solved Threads: 36
Posting Whiz
langsor is offline Offline
389 posts
since Aug 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Using an Array to data into A DB
Next Thread in PHP Forum Timeline: Page Searcher





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC