title: Changing the `from` address when sending an email through GMail
body: <p>I'm trying to use PHP Pear Factory to send emails through GMail in one project. It has been successful, but there is something that is not working 100% properly.</p>
  
  <p>I don't know why if I set <code>$headers['From'] = 'from@domain.com'</code>, when I receive the email the From is username@gmail.com.</p>
  
  <p>Find below the code:</p>
  
  <p>
  
  <pre><code>$recipients = 'to@domain.com';
  
  $headers['From']    = 'from@domain.com';
  $headers['To']      = 'to@domain.com';
  $headers['Subject'] = 'Test message';
  
  $body = 'Test message';
  
  $params["host"] = 'ssl://smtp.gmail.com';
  $params["port"] = 465;
  $params["auth"] = true;
  $params["username"] = 'username@gmail.com';
  $params["password"] = 'password';
  
  
  // Create the mail object using the Mail::factory method
  $mail_object =&amp; Mail::factory('smtp', $params);
  
  $send = $mail_object-&gt;send($recipients, $headers, $body);
  
  if(PEAR::isError($send)) { print($send-&gt;getMessage()); }
  </code></pre>