need help in send and email

Thread Solved

Join Date: Jul 2008
Posts: 39
Reputation: god_1896 is an unknown quantity at this point 
Solved Threads: 0
god_1896 god_1896 is offline Offline
Light Poster

need help in send and email

 
0
  #1
Aug 15th, 2008
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,
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,
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: need help in send and email

 
0
  #2
Aug 15th, 2008
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.

  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 ...
  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
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 39
Reputation: god_1896 is an unknown quantity at this point 
Solved Threads: 0
god_1896 god_1896 is offline Offline
Light Poster

Re: need help in send and email

 
0
  #3
Aug 15th, 2008
hi, well i found somthing difference, this is more getting worry of me.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: need help in send and email

 
0
  #4
Aug 15th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 39
Reputation: god_1896 is an unknown quantity at this point 
Solved Threads: 0
god_1896 god_1896 is offline Offline
Light Poster

Re: need help in send and email

 
0
  #5
Aug 15th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 381
Reputation: langsor is an unknown quantity at this point 
Solved Threads: 33
langsor langsor is offline Offline
Posting Whiz

Re: need help in send and email

 
0
  #6
Aug 15th, 2008
No worries, glad you got it figured out.

:-)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC