Contact Form 7
Add attachment with WPCF7_ContactForm class (4 posts)

  1. josjojo
    Posted 5 years ago #

    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;


  2. lupark
    Posted 5 years ago #

    fyi, there's another topic about this here: http://bit.ly/c4rkk3+

  3. djlo
    Posted 5 years ago #

    Hello, just wondering if anyone managed to have a .pdf created from a contact form that users submitted? @josjojo, were you able to do this?

  4. Karena Kreger
    Posted 5 years ago #

    josjojo - did you ever get this working? Would you care to share your code or plugin? I desperately need to turn a form into a PDF and mail it to clients when submitted. Any thoughts?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Contact Form 7
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic