title: How do I send email on heroku using PHP?
body: <p>I have created PHP app and deployed using heroku. In the app, I have contact form to send mails to my gmail account. To implement this, I have written the following PHP code</p>
  
  <pre><code>&lt;?php
     $to = "to@gmail.com";
     $subject = "This is subject";
     $message = "This is simple text message.";
     $header = "From:from@yantranet.com \r\n";
     $retval = mail ($to,$subject,$message,$header);
     if( $retval == true ){
        echo "Message sent successfully...";
     }else{
        echo "Message could not be sent...";
     }
  ?&gt;
  </code></pre>
  
  <p>My php script is executing. But it is not sending mail instead it is showing up <code>Message could not be sent</code>. Can any one help to implement contact form using PHP?</p>