WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
Sending an attachment via Email(2) (6 posts)

  1. mimoes
    Member
    Posted 2 years ago #

    Hello, hope you could please help...

    I'm using Contact Form 7 in order to send:

    - Email(1) Sended to me, with everything people write on form. This part is ok.
    - Email (2) Sended to the one who completed the form. I would like to automatically send an attachment with this email. Is it possible to do that?

    People is completing this form in order to receive a coupon, and I will like to automatically send them a PDF file.

    Thanks in advance, I'm getting really impressed with Contact Form 7, I'm loving it!

    http://wordpress.org/extend/plugins/contact-form-7/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    Add this to your theme's functions.php:

    add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components' );
    
    function mycustom_wpcf7_mail_components( $components ) {
    	$components['attachments'][] = 'full path of your PDF file';
    
    	return $components;
    }
  3. mimoes
    Member
    Posted 2 years ago #

    Thank you, Takayuki, for your kind.

    I've done it, but it doesn't work... I've put the full path of the PDF file on the attachment textarea of the Email(2).

    Do I have to do something else?

  4. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    I've put the full path of the PDF file on the attachment textarea of the Email(2).

    No, I didn't write so.

    add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components' );
    
    function mycustom_wpcf7_mail_components( $components ) {
    	$components['attachments'][] = 'full path of your PDF file';
    
    	return $components;
    }

    Replace the full path of your PDF file part to the real full path of the PDF file.

  5. tilen
    Member
    Posted 2 years ago #

    Thank you, Takayuki.

    However, this doesn't seem to work for me either. I get the responsive message, but without the attachment.

    The added part of my "theme/functions.php" file looks like:

    add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components' );
    
    function mycustom_wpcf7_mail_components( $components ) {
    	$components['attachments'][] = 'http://www.website.com/files/testni.pdf';
    
    	return $components;
    }

    Shall I write anything else here?

  6. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    Full file path. Not URL.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic