title: PHPMailer using SMTP username as senders email address
body: <p>So I'm trying to send an email using current version of PHPMailer (<a href="https://github.com/PHPMailer/PHPMailer" rel="nofollow">https://github.com/PHPMailer/PHPMailer</a>). The SMTP connection and the mail sending is working fine, except the script is not using the "SetFrom" $email variable for the senders mail, but instead the "Username" email.</p>
  
  <p>I've tried using multiple forms of setting the "From" mail and nothing seems to work, although it's important to note that the "name" in the "SetForm" is set just fine, but "email" is not.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>    $mail = new PHPMailer;
  
      $mail-&gt;isSMTP();                                   
      $mail-&gt;Host = 'smtp.gmail.com';                     
      $mail-&gt;SMTPAuth = true;                            
      $mail-&gt;Username = 'USERNAME(MY EMAIL)';      
      $mail-&gt;Password = 'PASSWORD';                    
      $mail-&gt;SMTPSecure = 'tls';                        
      $mail-&gt;Port = 587;
  
      $mail-&gt;isHTML(true);
  
      $mail-&gt;SetFrom($email,$name);
      $mail-&gt;addAddress($email_received);                 
  
      $mail-&gt;Subject = $subject;
      $mail-&gt;Body = $user_msg;
  </code></pre>