title: How to attach PDF to email using PHP mail function
body: <p>I am sending an email using PHP mail function, but I would like to add a specified PDF file as a file attachment to the email. How would I do that?</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>$to = "me@myemail.com";
  $subject = "My message subject";
  $message = "Hello,\n\nThis is sending a text only email, but I would like to add a PDF attachment if possible.";
  $from = "Jane Doe &lt;janedoe@myemail.com&gt;";
  
  $headers = "From:" . $from; 
  mail($to,$subject,$message,$headers);
  
  echo "Mail Sent!";
  </code></pre>