title: How to trigger mail function when submit button clicked
body: <p>I'm trying to make an application to send emails when a button is clicked. I tried to use isset function to do that. But my code doesn't work well.  How do I fix it? </p>
  
  <p>Demo below:</p>
  
  <pre><code>&lt;!-- &lt;button name="sendemail"&gt;send&lt;/button&gt; --&gt;
  &lt;input type="submit"  value="send"/&gt;
  &lt;?php 
  if(isset($_POST['Submit'])){
  ?&gt;
  &lt;?php
  
  // multiple recipients
  // $to  = 'aidan@example.com' . ', ';   
  // $to .= 'wez@example.com';
  $to="example@outlook.com";
  // subject
  $subject = 'test01';
  
  // message
  $message = '
  &lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Birthday Reminders for August&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;p&gt;Here are the birthdays upcoming in August!&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  ';
  
  $headers  = 'MIME-Version: 1.0' . "\r\n";
  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  $headers .= 'To: Mary &lt;mary@example.com&gt;, Kelly &lt;kelly@example.com&gt;' . "\r\n";
  $headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
  
  
  
      mail($to, $subject, $message, $headers);
  }
  ?&gt;
  </code></pre>