title: SetFrom PHPMailer not working
body: <p>I am using gmail SMTP to send the mail with the help of phpmailer library. It is sending mails fine but it is not sending from the mail address that I am setting in SetFrom address. Here is my code:</p>
  
  <pre><code>&lt;?php
  require 'phpmailer/class.phpmailer.php';
  $mail = new PHPMailer;
  
  $mail-&gt;IsSMTP();
  $mail-&gt;SMTPAuth = true;
  $mail-&gt;Host = "smtp.gmail.com";
  $mail-&gt;Port = 587;
  $mail-&gt;Username = "myusername@gmail.com";
  $mail-&gt;Password = "gmail_password";
  
  $mail-&gt;From         = 'donotreply@mydomain.com';
  $mail-&gt;FromName     = 'Admin';
  $mail-&gt;AddAddress('Toreceiver@test.com', 'Receiver');  // Add a recipient
  $mail-&gt;IsHTML(true);
  
  $mail-&gt;Subject = 'Here is the Subject';
  $mail-&gt;WordWrap = 50;  
  $mail-&gt;Body = "This is in &lt;b&gt;Blod Text&lt;/b&gt;";
  $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;
  }
  
  echo 'Message has been sent';
  ?&gt;
  </code></pre>
  
  <p>It is sending mail from myusername@gmail.com  but I want it to send with 'donotreply@mydomain.com' as set in $mail->From. Any help will be highly appreciated.</p>