title: Sending an email using php mail function - change default email address
body: <p>I am trying to send a confirmation email to people who sign up at my site. </p>
  
  <p>The problem is that the email is being sent from my default cpanel email account (which, according to Hostgator cannot be changed). </p>
  
  <p>I have other email addresses set up in cpanel.  Can't I send using one of them?</p>
  
  <pre><code>            // ---------------- SEND MAIL FORM ----------------
              // send e-mail to ...
              $to=$user;
              // Your subject
              $subject="Confirmation link";
  
              // From
              $header="from: your name &lt;your email&gt;";
              // Your message
              $message="Your confirmation link \r\n";
              $message.="Click on this link to activate your account \r\n";
              $message.="http://mysite.co/confirmation.php?passkey=$confirm_code";
              // send email
              $sentmail = mail($to,$subject,$message,$header);
  </code></pre>