WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. levseltzer
    Member
    Posted 1 year 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:
    http://labinsky.com/test/
    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:
    http://wordpress.org/support/topic/contact-form-7-sending-attachments-without-user-upload
    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.

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

  2. levseltzer
    Member
    Posted 7 months 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
    Member
    Posted 7 months 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:
    /home/content/l/a/b/labinsky/html/wp-content/uploads/FinancialGuide-Chapter08.pdf

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.