I am making a plugin/hook for Contact Form 7 that makes a pdf of the form and mails it. I managed to generate a pdf with TCPDF (www.tcpdf.com). This pdf is generated in wp-content/uploads/wpcf7_uploads.
How can I add the pdf as attachment to the mail? I tried the following, but the pdf file was not attached to the mail.
add_action('wpcf7_before_send_mail', 'wpcf7_makepdf');
function wpcf7_makepdf(&$wpcf7_class) {
...generate pdf...
$wpcf7_class->posted_data['pdf'] = basename($pdf_file);
$wpcf7_class->uploaded_files['pdf'] = $pdf_file;
}