Cf7 and fpdf – how to generate filenames by user and attach pdf to mail?
-
I am desperately trying to generate PDF files with user generated names by using data from cf7 form. The PDF files should send as attachement via cf7’s mail function.
$fileName = 'LS18-' . $posted_data["lesernummer"] . '.pdf'; $pdf->Output(FPDF_PATH. $fileName, 'F'); add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components' ); function mycustom_wpcf7_mail_components($components){ if (empty($components['attachments'])) { $filepath = FPDF_PATH .$filename; $components['attachments'] = $filepath; } return $components; }
In makepdf.php first part is working. It generates files with names like LS-00019.pdf, LS18-12345.pdf and so on.
I am struggling with the second part. cf7 does not send the pdf file as attachement.Thank you for your help!
- The topic ‘Cf7 and fpdf – how to generate filenames by user and attach pdf to mail?’ is closed to new replies.