Jump to content

Recommended Posts

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?

 

 

Link to comment
https://forums.phpfreaks.com/topic/192537-php-error/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014448
Share on other sites

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]

Link to comment
https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014469
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014470
Share on other sites

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); 

 

Link to comment
https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014473
Share on other sites

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014488
Share on other sites

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!

Link to comment
https://forums.phpfreaks.com/topic/192537-php-error/#findComment-1014493
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.