title: Using php to send information
body: <p>I have a simple password send that will send them their password when they enter their email but the only problem is that I am getting an error when I load the page that says</p>
  
  <blockquote>
    <p>Failed to add recipient: @localhost [SMTP: Invalid response code
    received from server (code: 501, response: &lt;@localhost>: no local
    part)]</p>
  </blockquote>
  
  <p>I know that the information is correct. Here is the code- (Yes I know not using mysqli is insecure. This is for a quick thing.)</p>
  
  <pre><code> &lt;?php
    $username = "sdfsdfsdf";
    $password = "sdfsdfsdf";
    $hostname = "dsfsdfsdf";    
    $dbconn = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");
    $emailto  = $_POST['email'];
  
    $database = mysql_select_db("jjlliinn_test",$dbconn);
  
    $query  = "SELECT password FROM agentclient WHERE email = '$emailto'";
    $result = mysql_query($query) or die(mysql_error());
    $data = mysql_fetch_assoc($result);
  
  
  
  // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // 
   require_once "Mail.php";
  
   $from = "JLP &lt;no-reply@sdfsdfsdfsdfsdfsdfsdf.net&gt;";
   $to = "$toemail";
   $subject = "Your password";
   $body = "Hi,\n\nYour password is $data.";
  
   $mailhost = "mail.sdfsdfsdfsdf.net";
   $mailusername = "no-reply@sdfsdfsdfsdf.net";
   $mailpassword = "Uq?sdfsdfsdfsdfsdf-";
  
   $headers = array ('From' =&gt; $from,
     'To' =&gt; $to,
     'Subject' =&gt; $subject);
   $smtp = Mail::factory('smtp',
     array ('host' =&gt; $mailhost,
       'auth' =&gt; true,
       'username' =&gt; $mailusername,
       'password' =&gt; $mailpassword));
  
   $mail = $smtp-&gt;send($to, $headers, $body);
  
   if (PEAR::isError($mail)) {
     echo("&lt;p&gt;" . $mail-&gt;getMessage() . "&lt;/p&gt;");
    } else {
     echo("&lt;p&gt;Password successfully sent!&lt;/p&gt;");
    }
      mysql_close($dbconn);  
   ?&gt;
  </code></pre>