When clicking the button a pdf is generated and opens the pdf in the web browser. I would like for the pdf to be stored temporary in a variable and included in mail as attachment when the buttons i clicked.
I'm struggling with how to save and attach the file.
<a class="button" href="http://mydomian.com/pdf001.php">Send PDF</a>
<?php
$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "
" .
'Reply-To: webmaster@example.com' . "
" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
See Question&Answers more detail:os