| | |
need help in send and email
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jul 2008
Posts: 39
Reputation:
Solved Threads: 0
•
•
•
•
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
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
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.
... should be ...
... since you don't use the var keyword to initialize variables in PHP
Hope this helps, let us know
PHP Syntax (Toggle Plain Text)
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";
PHP Syntax (Toggle Plain Text)
$email; $senderName; $senderPhone; $senderEmail; $senderSubject; $senderMessage; $returnEmail; $header; $type = "text/plain"; $characterSet = "iso-8859-1";
Hope this helps, let us know
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
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
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
![]() |
Similar Threads
- can not send email and cannot send file through instant messaging (Windows NT / 2000 / XP)
- Can't send email (Windows NT / 2000 / XP)
- unable to upload files or send email on wireless (Windows NT / 2000 / XP)
- Cannot Upload files or send email on wireless (Web Browsers)
- Using PHP to Send Email to a single DB list member every 24 hrs. (PHP)
- Batch file to send email!! (Windows NT / 2000 / XP)
- Not able to send email by "MAIL" (OS X)
Other Threads in the PHP Forum
- Previous Thread: Using an Array to data into A DB
- Next Thread: Page Searcher
| Thread Tools | Search this Thread |
ajax apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date decode display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail match md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf php problem protocol query radio random recursion regex remote script search server session sessions sms smtp soap source space sql strip_tags survey syntax system table tutorial undefined update upload url validator variable video virus votedown web window.onbeforeunload=closeme; xml youtube





