473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

mail() gives error: SMTP server response: 503 5.5.2 Need Rcpt command

Hi to All.
I am Punit .I am back with new question .Please help me.
I want to create one enquiry form in php.for this I code it:
form code:
Expand|Select|Wrap|Line Numbers
  1. <form name="enquiry" method="post"  action="enquiry.php">
  2.  
  3.  
  4.  
  5.  
  6.  
  7.         <table width="494" border="0" cellspacing="0" cellpadding="2" height="511">
  8.             <tr>
  9.                 <td colspan="2" align="left" valign="top" height="29">
  10.                 <p align="left"><font face="Verdana" color="#FFFFFF">Fields marked with * are mandatory 
  11.                 </font></td>
  12.             </tr>
  13.             <tr>
  14.                 <td align="left" valign="top" bgcolor="#FFFFFF" height="27">
  15.                 <font face="Verdana" size="2">Title *</font></td>
  16.                 <td align="left" valign="top" bgcolor="#FFFFFF" height="27">
  17. <font face="Verdana" size="3">
  18. <select name="ddlTitle" id ="ddlTitle" size="1" style="border: 1px solid #315D10" tabindex="1">
  19.                 <option value="Mr">Mr</option>
  20.                 <option value="Mrs">Mrs</option>
  21.                 <option value="Ms">Ms</option>
  22.                 <option value="Miss">Miss</option>
  23.                 <option value="Dr">Dr</option>
  24.                 </select></font></td>
  25.             </tr>
  26.             <tr>
  27.                 <td align="left" valign="top" bgcolor="#FFFFFF" height="25">
  28.                 <font face="Verdana" size="2"><label for="firstname">First Name *</label></font></td>
  29.                 <td align="left" valign="top" bgcolor="#FFFFFF" height="25">
  30.                 <font face="Verdana"><font face="Verdana" size="3">
  31.                 <input type="text" name="txtFirstName" id ="txtFirstName" size="25" maxlength="30" style="border: 1px solid #315D10" tabindex="2"></font><font size="2">
  32.                 </font></font>
  33.                           </td>
  34.             </tr>
  35.             <tr>
  36.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  37.                 <font face="Verdana" size="2"><label for="lastname">Last Name *</label></font></td>
  38.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  39.         <font face="Verdana"><font face="Verdana" size="3">
  40.         <input type="text" name="txtLastName" id ="txtLastName" size="25" style="border: 1px solid #315D10" tabindex="3"></font><font size="2">
  41.         </font></font>
  42.                           </td>
  43.             </tr>
  44.             <tr>
  45.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  46.                 <font face="Verdana" size="2"><label for="postaladdress">Postal Address *</label></font></td>
  47.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  48.                 <font face="Verdana"><font face="Verdana" size="3">
  49. <textarea name="txtPostalAddress" id ="txtPostalAddress" cols="22" wrap="VIRTUAL" rows="3" style="border: 1px solid #315D10" tabindex="5"></textarea><font size="2">
  50.                 </font></font>
  51.                           </td>
  52.             </tr>
  53.             <tr>
  54.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  55.                 <font face="Verdana" size="2"><label for="town">Town</label></font></td>
  56.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  57. <font face="Verdana" size="3"><input type="text" name="txtTown" size="25" style="border: 1px solid #315D10" tabindex="6"></font></td>
  58.             </tr>
  59.             <tr>
  60.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  61.                 <font face="Verdana" size="2"><label for="pincode">Pin code</label></font></td>
  62.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  63.                 <font size="2" face="Verdana">
  64.                 <input type="text" name="txtPinCode" size="25" style="border: 1px solid #315D10" tabindex="7"></font></font></td>
  65.             </tr>
  66.  
  67.             <tr>
  68.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  69.                 <font face="Verdana" size="2"><label for="country">Country</label></font></td>
  70.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  71.                 <font face="Verdana"><font face="Verdana" size="3">
  72.                 <input type="text" id="country" name="txtCountry" size="25" style="border: 1px solid #315D10" tabindex="8"></font><font size="2">
  73.                 </font></font>
  74.                           </td>
  75.             </tr>
  76.             <tr>
  77.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  78.                 <font face="Verdana" size="2"><label for="telephone">Telephone *</label></font></td>
  79.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  80. <font face="Verdana"><font face="Verdana" size="3">
  81. <input type="text" name="txtTelephone" id ="txtTelephone" size="25" maxlength="14" style="border: 1px solid #315D10" tabindex="9"></font><font size="2">
  82. </font></font>
  83.                           </td>
  84.             </tr>
  85.             <tr>
  86.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  87.                 <font face="Verdana" size="2"><label for="fax">Fax</label></font></td>
  88.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  89.                 <font face="Verdana"><font face="Verdana" size="3">
  90.                 <input type="text" name="txtFax" size="25" style="border: 1px solid #315D10" tabindex="10"></font><font size="2">
  91.                 </font></font>
  92.                           </td>
  93.             </tr>
  94.             <tr>
  95.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  96.                 <font face="Verdana" size="2"><label for="email">E-mail 
  97.                 *</label></font></td>
  98.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  99.                 <font face="Verdana"><font face="Verdana" size="3">
  100.                 <input type="text" name="txtEmail" id ="txtEmail" size="25" style="border: 1px solid #315D10" tabindex="11"></font><font size="2">
  101.                 </font></font>
  102.                           </td>
  103.             </tr>
  104.             <tr>
  105.                 <td align="left" bgcolor="#FFFFFF">
  106.                 <font face="Verdana" size="2"><label for="comments">Your Enquiry</label></font></td>
  107.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  108.                 <font face="Verdana"><font face="Verdana" size="3">
  109.                 <textarea name="txtYourEnquiry" cols="30" rows="8" wrap="VIRTUAL" style="border: 1px solid #315D10" tabindex="12"></textarea></font><font size="2">
  110.                 </font></font>
  111.                          </td>
  112.             </tr>
  113.             <tr>
  114.                 <td bgcolor="#FFFFFF">&nbsp;</td>
  115.                 <td align="left" valign="top" bgcolor="#FFFFFF">&nbsp;</td>
  116.             </tr>
  117.             <tr>
  118.                 <td bgcolor="#FFFFFF">&nbsp;</td>
  119.                 <td align="left" valign="top" bgcolor="#FFFFFF">
  120.                 <font face="Verdana"><font face="Verdana" size="3">
  121.                 <input type="submit" name="btnSubmit" value="Submit" style="border:1px solid #315D10; " onclick = "return Validate();"  tabindex="13"></font><font size="2"> &nbsp; &nbsp; &nbsp; &nbsp;
  122.  
  123.  
  124.  
  125.                 </font><font face="Verdana" size="3">
  126.  
  127.  
  128.  
  129.                 <input type="reset" name="btnReset" value="Reset" style="border: 1px solid #315D10" tabindex="14"></font><font size="2">
  130.                 </font></font>
  131.                         </td>
  132.             </tr>
  133.             <tr>
  134.                 <td bgcolor="#FFFFFF">&nbsp;</td>
  135.                 <td align="left" valign="top" bgcolor="#FFFFFF">&nbsp;
  136.                 </td>
  137.             </tr>
  138.         </table>
  139.     </form>
Coding for enquiry.php is:
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2.  
  3. $Title = $_POST['ddlTitle'];
  4.  
  5. $FirstName = $_POST['txtFirstName'];
  6.  
  7. $LastName = $_POST['txtLastName'];
  8.  
  9. $PostalAddress = $_POST['txtPostalAddress'];
  10.  
  11. $Town = $_POST['txtTown'];
  12.  
  13. $PinCode = $_POST['txtPinCode'];
  14.  
  15. $Country = $_POST['txtCountry'];
  16. $Telephone = $_POST['txtTelephone'];
  17. $Fax = $_POST['txtFax'];
  18. $Email =$_POST['txtEmail'];
  19.  
  20. $YourEnquiry = $_POST['txtYourEnquiry'];
  21.  
  22.  
  23.  
  24. $mes= $mes & "<b>Title:- </b>" & $Title & "<br>";
  25. $mes= $mes & "<b>First Name:- </b>" & $FirstName & "<br>";
  26. $mes= $mes & "<b>Last Name:- </b>" & $LastName & "<br>";
  27. $mes= $mes & "<b>Postal Address:- </b>" & $PostalAddress & "<br>";
  28.  
  29. $mes= $mes & "<b>Town:- </b>" & $Town & "<br>";
  30.  
  31. $mes= $mes & "<b>Pin Code:- </b>" & $PinCode & "<br>";
  32.  
  33. $mes= $mes & "<b>Country:- </b>" & $Country & "<br>";
  34.  
  35. $mes= $mes & "<b>Telephone :- </b>" & $Telephone & "<br>";
  36.  
  37. $mes= $mes & "<b>Fax :- </b>" & $Fax & "<br>";
  38.  
  39. $mes= $mes & "<b>Email :- </b>" & $Email & "<br>";
  40.  
  41. $mes= $mes & "<b>YourEnquiry:- </b>" & $YourEnquiry & "<br>";
  42.  
  43.  
  44.  
  45. $header="from: $Email <$mail_from>"; 
  46. $Subject= 'enquiryform';
  47. $From = '$Email';
  48. $To= '__MUNGED__';
  49. $message = '$mes';
  50. $send_contact = mail($to,$subject,$message,$header);
  51. if($send_contact)
  52. {
  53. echo "We've recived your contact information";
  54. }
  55. else
  56. {
  57. echo "ERROR";
  58. }
  59. ?>
  60.  
it is not executing.It gives warning:

Warning: mail() [function.mail]: SMTP server response: 503 5.5.2 Need Rcpt command. in C:\Uniform3_1_1s\www\abc\enquiry.php on line 58
ERROR
Please suggest me what i do.As i am new in php so kindly suggest me wht i do.please help me.

Thanks
Punit Shrivastava
Sep 22 '07 #1
8 28199
For start, please wrap the code in your post in [ PHP ] [ /PHP ] tags,
i don't want to count the lines till line 58...
Sep 22 '07 #2
Hi etiainen,
i use the code for enquire form is:
[php]
<?php

$Title = $_POST['ddlTitle'];

$FirstName = $_POST['txtFirstName'];

$LastName = $_POST['txtLastName'];

$PostalAddress = $_POST['txtPostalAddress'];

$Town = $_POST['txtTown'];

$PinCode = $_POST['txtPinCode'];

$Country = $_POST['txtCountry'];
$Telephone = $_POST['txtTelephone'];
$Fax = $_POST['txtFax'];
$Email =$_POST['txtEmail'];

$YourEnquiry = $_POST['txtYourEnquiry'];



$mes= $mes & "<b>Title:- </b>" & $Title & "<br>";
$mes= $mes & "<b>First Name:- </b>" & $FirstName & "<br>";
$mes= $mes & "<b>Last Name:- </b>" & $LastName & "<br>";
$mes= $mes & "<b>Postal Address:- </b>" & $PostalAddress & "<br>";

$mes= $mes & "<b>Town:- </b>" & $Town & "<br>";

$mes= $mes & "<b>Pin Code:- </b>" & $PinCode & "<br>";

$mes= $mes & "<b>Country:- </b>" & $Country & "<br>";

$mes= $mes & "<b>Telephone :- </b>" & $Telephone & "<br>";

$mes= $mes & "<b>Fax :- </b>" & $Fax & "<br>";

$mes= $mes & "<b>Email :- </b>" & $Email & "<br>";

$mes= $mes & "<b>YourEnquiry:- </b>" & $YourEnquiry & "<br>";



$header="from: $Email <$mail_from>";
$Subject= 'enquiryform';
$From = '$Email';
$To= '__MUNGED__';
$message = '$mes';
$send_contact = mail($to,$subject,$message,$header);
if($send_contact)
{
echo "We've recived your contact information";
}
else
{
echo "ERROR";
}
?>
[/php]
but this send error message & the message is:

Warning: mail() [function.mail]: SMTP server response: 503 5.5.2 Need Rcpt command.
Please suggest me what i do.
Thanks & Regards.
Punit Shrivastava
For start, please wrap the code in your post in [ PHP ]
[ /PHP ] tags,
i don't want to count the lines till line 58...
Sep 22 '07 #3
pbmods
5,821 Expert 4TB
Heya, Punit.

You define $To, but you use $to. In PHP, variable names are case-sensitive.
Sep 22 '07 #4
i was just about to say that. Also check your other variables.....
Sep 22 '07 #5
pbmods
5,821 Expert 4TB
Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).
Sep 22 '07 #6
Hi pbmods,
Thanks for valuable suggestion.
Now i correct all the variable which i define in coding.it is not showing any error. but it is not working.means it is not showing error but not sending mail.please suggest me. what i do.please
Thanks & Regards
Punit Shrivastava
Heya, Punit.

You define $To, but you use $to. In PHP, variable names are case-sensitive.
Sep 25 '07 #7
pbmods
5,821 Expert 4TB
Heya, Punit.

In your code:
Expand|Select|Wrap|Line Numbers
  1. $mes= $mes & "<b>Title:- </b>" & $Title & "<br>";
  2.  
In PHP, '&' is a bitwise operator, which will give very different results than what you're trying to accomplish.

You probably meant to do this:
Expand|Select|Wrap|Line Numbers
  1. $mes .= '<b>Title:- </b>' . $Title . '<br />';
  2.  
I don't know why anybody uses ASP anymore....
Sep 25 '07 #8
Hi pbmods,
Thanks for giving me valuable suggestion .But it is not sending mail.Is there any setup which i have to create for SMTP server .Because it is not showing any error but it is not working .Please suggest me what i do.
Thanks
Punit Shrivastava
Heya, Punit.

In your code:
Expand|Select|Wrap|Line Numbers
  1. $mes= $mes & "<b>Title:- </b>" & $Title & "<br>";
  2.  
In PHP, '&' is a bitwise operator, which will give very different results than what you're trying to accomplish.

You probably meant to do this:
Expand|Select|Wrap|Line Numbers
  1. $mes .= '<b>Title:- </b>' . $Title . '<br />';
  2.  
I don't know why anybody uses ASP anymore....
Oct 3 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: ashim.chowdhury | last post by:
While using mail() function in PHP I am getting thjis error Warning: mail(): SMTP server response: 505 5.7.3 Must issue a STARTTLS command first I have used...
9
bonski
by: bonski | last post by:
hello everybody.. i just want to know what this error means... Error: mail() : SMTP server response: 501 #5.1.1 bad address the smtp set up was correct.. valid emails... and port. so im just...
5
by: deepakNagpal | last post by:
hi friends i am trying to create a contact feedback form. but when i am running the code it showing some warning: Please if anyone can help me. PHP Warning: mail() : SMTP server response:...
2
by: Ronald Raygun | last post by:
I am calling the mail() function in a PHP script and I get the ff error: Warning: mail() : SMTP server response: 501 5.5.4 Invalid Address in C:\test\test.php on line 394 Relevant Info: OS:...
1
by: creative1 | last post by:
I am trying to setup contactus page. and testing it to work throug localhostI. I ahve setup everything php.ini and even tred to use following to make sure that everything is ok: ...
7
by: mukeshrasm | last post by:
Hi I am no able to send mail and it is giving this error Warning: mail(): SMTP server response: 530 5.7.3 Client was not authenticated in c:\inetpub\wwwroot\eshop\includes\classes\email.php on...
6
by: phpmagesh | last post by:
Hi, I am using mail function in my php page, As soon i update the details, i have to send mail to the customer with the updated details, problem is when i send mail it simple through waring msg...
1
by: lisa007 | last post by:
Warning: mail() : SMTP server response: 503 valid RCPT command must precede DATA on whenever user click on to get new password but doesnt fill in the username field it shows that message i have...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.