Guest Posted February 18, 2010 Share Posted February 18, 2010 On my .php page I have a drop down box that has several names in it. When a user clicks the name & fills the rest of the form out, an email is sent to a supervisor. It works great EXCEPT, if I choose the first choice in the drop down box & submit it I get an error. Here is the line of code the error references: if (mail($email, "message1", $message, "message2")) { The error is below: Notice: Undefined variable: email on line 74 Warning: mail() [function.mail]: SMTP server response: 503 Issue RCPT TO: command before DATA command on line 74 Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/ Share on other sites More sharing options...
schilly Posted February 18, 2010 Share Posted February 18, 2010 Why are you passing in "Message2" as a header? Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014433 Share on other sites More sharing options...
Guest Posted February 18, 2010 Share Posted February 18, 2010 is that the problem? it works fine if I choose the other itens from the drop down list? It only fails if I choose the first choice... message 2 comes up in the body of the email Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014440 Share on other sites More sharing options...
schilly Posted February 18, 2010 Share Posted February 18, 2010 http://php.net/manual/en/function.mail.php The 3rd parameter is your email body. The 4th parameter is headers like To: From: BCC: CC: etc. Change to: if (mail($email, "message1", $message)) { // $email = to address, "message1" = subject, $message = email body You should only use the 4th parameter if you are adding extra headers. Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014448 Share on other sites More sharing options...
Guest Posted February 18, 2010 Share Posted February 18, 2010 That didn't fix it...I'm attaching my the entire php code file. Hopefully someone will see the problem in the code...Again, it works great as long as I don't choose SUPERVISOR1 from the drop down box. If I choose SUPERVISOR2 or SUPERVISOR3 from the drop down list, everything works perfect...I'm clueless [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014469 Share on other sites More sharing options...
Guest Posted February 18, 2010 Share Posted February 18, 2010 In reference to the above post I'be posted the error I get below: Error, no supervisor selected!!! Notice: Undefined variable: email in C:\wamp\www\222222.php on line 47 Warning: mail() [function.mail]: SMTP server response: 503 Issue RCPT TO: command before DATA command in C:\wamp\www\222222.php on line 47 This system is not working properly. Please contact IT so he can fix it. Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014470 Share on other sites More sharing options...
schilly Posted February 18, 2010 Share Posted February 18, 2010 echo $email and $message right before the mail fn is called. It sounds like $email is not being set properly and the mail fn craps out because it is not a valid address. Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014472 Share on other sites More sharing options...
LeadingWebDev Posted February 18, 2010 Share Posted February 18, 2010 look... this 1 is completely working on mimun-ishi.com $name = $fname." ".$lname; //senders name $tel = "$phone"; //senders phone $recipient = "mimun.ishi@gmail.com"; //recipient $rec_copy = "mimun.leads@gmail.com"; $mail_body = "A new customer left his contact information for you to call him back \n"; $mail_body .= "First Name: $fname \n"; $mail_body .= "Last Name: $lname \n"; $mail_body .= "Passport Number: $tz \n"; $mail_body .= "Phone Number: $tel \n"; //mail body $subject = date("l d F Y")." New client want you to call him "; //subject $header = "From: ". $name . " <" . $tel . ">\r\n"; //optional headerfields //ini_set('sendmail_from', 'me@domain.com'); mail($recipient, $subject, $mail_body, $header); //mail command mail($rec_copy, $subject, $mail_body, $header); Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014473 Share on other sites More sharing options...
Guest Posted February 18, 2010 Share Posted February 18, 2010 I give up... Schilly - Thanks for your help. I appreciate it. Have a good day. Leading Web Dev...YOU LOOK! - If you'd read my post you'd see that is not what I'm needing. If you'd do more in your post than just copying & paste from other sites you MIGHT be helpful! Do you expect others in need of help to read your mind! Go ahead & delete my account! I'll never be back nor will I read any emails from the admins. This site's forums is useless & believe me I've seen many over the years & this one ranks very low in my opinion. Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014488 Share on other sites More sharing options...
premiso Posted February 18, 2010 Share Posted February 18, 2010 Sometimes it takes common sense to debug stuff. The "undefined variable" is pretty clear, $email is never being set. The SMTP 503 error is another one you can easily look up and find out what the issue is there. http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=503+Issue+RCPT+TO:+command+before+DATA Feel free to look at that and figure out what is wrong with your SMTP server. If you do not own the server, contact your webhost about that. But alas, you decided to just trash the forums because you lack the common sense to solve your own problems, such as knowing to email your host about the SMTP or even just googling the error to figure out why it is being caused. Either way good luck with other forums since this one is just junk, according to you! Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014493 Share on other sites More sharing options...
LeadingWebDev Posted February 18, 2010 Share Posted February 18, 2010 i c how and where. Good Luck i just dont want to start begging, ill be much educated. Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014497 Share on other sites More sharing options...
schilly Posted February 18, 2010 Share Posted February 18, 2010 just debug that $email variable when the supervisor1 is set and you should be fine. Quote Link to comment https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014514 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.