Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

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!

What I have tried:

PHP
$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;
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900