title: Sending Email Via CakePHP - Configuration email override the sender email
body: <p>I am having problem on sending email via cake php 2.7. Well, the email gets forwarded to the desired email address but there is problem in getting sender email address, as I am getting configuration email address in the place of sender email address. I have problem in getting how to fix this issue. It would be grateful if anybody could suggest anything regarding the issue.</p>
  
  <p>Some parts of code are:</p>
  
  <p>pages controller</p>
  
  <pre><code>public function sendEmail($data) {
      $email = new CakeEmail();
      $email-&gt;config('gmail');
      $email-&gt;emailFormat('html');
      $email-&gt;sender($data['User']['email_address'],$data['User']['name']);
      $email-&gt;from(array($data['User']['email_address'] =&gt; $data['User']['name']));   
      $email-&gt;to('configuration_email');
      $email-&gt;replyTo($data['User']['email_address']);
      $email-&gt;subject($data['User']['subject']);
      $message = 'Name: '.$data['User']['name'].'&lt;br&gt; How Did You Hear: '. $data['User']['how_did_you_hear'].
              '&lt;br&gt;Message: '.$data['User']['body'];
  
      if ($email-&gt;send($message))
      {
          return true;
      }else {
          return false;
      }
    }
  </code></pre>
  
  <p>email.php </p>
  
  <pre><code>public $gmail = array(
          'host' =&gt; 'ssl://smtp.gmail.com',
          'port' =&gt; 465,
          'username' =&gt; 'configuration_email',
          'password' =&gt; 'password',       
          'transport' =&gt; 'Smtp'
          );
  </code></pre>
  
  <p>'From' field is using configuration email instead of using $data['User']['email'].</p>
  
  <p>Thank you in advance!</p>