title: Can't get envelope sender to set correctly, email goes to spam in gmail
body: <p>I'm really stuck. The emails I'm generating have the nobody apache address set for the envelope sender.</p>
  
  <p>Here's my PHP code: </p>
  
  <pre><code>$to = $emailresult;
      include 'inc/msg/resetpassword.php';
      if(mail($to, $subject, $body, $headers, '-f' . $from)) {
          echo 'A temporary password has been sent to ' . $emailresult . '. Please check your inbox and logon with your new password';
          } else {
          echo("Message delivery failed...");
          }
  </code></pre>
  
  <p>The file included on line 2</p>
  
  <pre><code>&lt;?php
  $subject = "XXXClient Dashboard - Password Reset Request Received";
  $headers .= "From: XXX Alert &lt;".$from."&gt;\r\n" . "Reply-To: XXXSupport     &lt;support@XXX.com&gt;\r\n" . "X-Mailer: PHP/" . phpversion() . "\r\nX-originating-IP: XXX.167.43.105\r\n";
  $headers .= "MIME-Version: 1.0\r\n";
  $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
  
  $body = $email_header . '
      &lt;h1 style="color: #666666;font-weight: normal;font-size: 18px;text-align: center;padding: 0;margin: 0;"&gt;We have recieved a request to reset your password. &lt;/h1&gt;
      &lt;p&gt;Hello,
      &lt;br&gt;
      Your new temporary password is &lt;b&gt;' . $passwordresult .
      '&lt;/b&gt;. You may logon to the &lt;a style="color:#8A2BE2; text-decoration:none; font-weight:bold;" href="'. $site_url . '"&gt;XX Client Dashboard&lt;/a&gt; with your email address and temporary password, then visit the profile section where you can choose a new password.&lt;/p&gt;
  
  ' . $email_footer;
  ?&gt;
  </code></pre>
  
  <p>Here's the email source I'm getting: <a href="http://pastebin.com/nbGUaHP1" rel="nofollow">http://pastebin.com/nbGUaHP1</a></p>
  
  <p>Works fine to my work email, but when I send to gmail it always goes to spam. I have the -f flag set correctly but it doesn't want to change the envelope sender so I believe that's the problem. Anyone know why the envelope sender won't set with this code?</p>