Support » Plugin: Contact Form 7 » Can't add extra message info with $cf7->mail_2['body'].=$message;?

  • Hi,

    I am trying to get this function to work but the most simple adding som e extra message info isn’t working, see last line in the function

    add_action( ‘wpcf7_before_send_mail’, ‘createInvoice’);`
    function createInvoice($cf7) {
    //check if this is the right form $cf7 &$wpcf7_data
    //echo $cf7->id;
    if ($cf7->id==3235){
    echo “test”;
    $uploads = wp_upload_dir();
    //define some constants
    define (‘COUPON_UPLOAD_PATH’,$uploads[‘path’].’/coupons’);
    // …
    // …
    if ($cf7->mail[‘use_html’]==true)
    //I omitted all the stuff used to create
    //the pdf file, you have just to know that
    //$pdf_filename contains the filename to attach
    //Let’go to the file attachment!
    //$pdf_filename = “test.pdf”;
    //$cf7->uploaded_files = array ( ‘invoice’ => COUPON_UPLOAD_PATH.’/’.$pdf_filename );

    //append some text to the outgoing email
    $message=$nl.$nl.’Blah blah blah…..’.$nl;
    $message.=’So Long, and Thanks for All the Fish!’.$nl;

    original code found here:

Viewing 1 replies (of 1 total)
  • Ok last part is working but the main part adding a .pdf on the fly isn’t working 🙁
    I am developing with xampp and testing locally.

    When i use
    $cf7->uploaded_files = array ( ‘invoice’ => COUPON_UPLOAD_PATH.’/test.pdf’ );
    i get an email with a unamed .pdf of 0kb and the email message body is empty?

    Any tips?

Viewing 1 replies (of 1 total)
  • The topic ‘Can't add extra message info with $cf7->mail_2['body'].=$message;?’ is closed to new replies.