title: Message could not be sent.Mailer Error: You must provide at least one recipient email address
body: <p>i am trying to send a message to a selected email from my user database. i am getting the value of user_mail in body content perfectly, when i am sending it to "some@gmail.com but i am getting error "Message could not be sent.Mailer Error: You must provide at least one recipient", when i am trying to send to "user_email. Any suggestions? </p>
  
  <p>Codes:</p>
  
  <pre><code>&lt;?php require_once("connection.php");?&gt; 
  &lt;?require_once('libraries/PHPMailer.php');?&gt;
   /*** select the users name from the database ***/
      $dbh = new PDO("mysql:host=$mysql_hostname;dbname=$mysql_dbname", $mysql_username,         $mysql_password);
      /*** $message = a message saying we have connected ***/
  
      /*** set the error mode to excptions ***/
      $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
  
      $stmt = $dbh-&gt;prepare("SELECT user_email FROM users 
      WHERE user_id = :user_id" );
  
      /*** bind the parameters ***/
      $stmt-&gt;bindParam('user_id', $_SESSION['user_id'], PDO::PARAM_INT);
  
      /*** execute the prepared statement ***/
      $stmt-&gt;execute();
  
      /*** check for a result ***/
      $user_email = $stmt-&gt;fetchColumn();
     }
  catch (Exception $e)
  {
      /*** if we are here, something is wrong in the database ***/
      $message = 'We are unable to process your request. Please try again later"';
  }
  
  $mail = new PHPMailer;
  
  $mail-&gt;IsSMTP();                                      // Set mailer to use SMTP
  $mail-&gt;Host = 'smtp.mandrillapp.com';                 // Specify main and backup server
  $mail-&gt;Port = 587;                                    // Set the SMTP port
  $mail-&gt;SMTPAuth = true;                               // Enable SMTP authentication
  $mail-&gt;Username = 'someone@app.com';                // SMTP username
  $mail-&gt;Password = 'key';                  // SMTP password
  $mail-&gt;SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also      accepted
  
  $mail-&gt;From = 'someone@app.com';
  $mail-&gt;FromName = 'App';
  $mail-&gt;AddAddress ($user_mail);  // Add a recipient
  
  $mail-&gt;IsHTML(true);                                  // Set email format to HTML
  
  $mail-&gt;Subject = ' Subject';
  $mail-&gt;Body    = ' working fine';
  $mail-&gt;AltBody = 'This is the body in plain text for non-HTML mail clients';
  
  if(!$mail-&gt;Send()) {
  echo 'Message could not be sent.';
  echo 'Mailer Error: ' . $mail-&gt;ErrorInfo;
  exit;
  }
  </code></pre>