Contact Form 7
[resolved] Sending an attachment via Email(2) (3 posts)

  1. levseltzer
    Posted 2 years ago #

    On the page http://wordpress.org/support/topic/sending-an-attachment-using-contact-form-7?replies=6 I found code to send an attachment to someone that fills out a form.
    I copied the code, configured it for the particular PDF file I want to send, and ran a test. The email arrives (both mail and mail(2)) but no attachment. The site is hosted on godaddy, and I am using the absolute path to the file.
    The page is here:
    This is the code that is currently in the file (functions.php):

    add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components' );

    function mycustom_wpcf7_mail_components( $components ) {
    $components['attachments'][] = '/home/content/l/a/b/labinsky/html/webroot/wp-content/uploads/FinancialGuide-Chapter08.pdf';
    return $components;
    What can I do to get this to work?

    There was some another example to send a file here:
    I could not follow this example, and did not want to try because so many people wrote that the code was not working for them. Is there other code that works?

    Thank you.


  2. levseltzer
    Posted 1 year ago #

    It has been four months since the first post. Has anything happened in the industry since then that would enable me to easily send out an attachment to someone that fills out a form.

  3. levseltzer
    Posted 1 year ago #

    Solution: You can use Mail(2) for this. However, you must include the full file path to the attachment. So on the godaddy server I was using, that path turned out to be:

    Once I put this code in, the attachment was sent properly.

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


No tags yet.