[Plugin: Contact Form 7] Attachment Issue
-
I ran into an issue with attaching files to an email through a contact form. I’m using the form for a lengthy financing application, so it’s pretty complex.
I can confirm I can send email with the correct attachment with the following method:
$header = "Content-type:text/plain; charset=iso-8859-1\r\n"; $testmail = wp_mail("[email protected]", "test", "testing this email thing", $header, array($_SERVER['DOCUMENT_ROOT']."/wp-content/themes/thematic/coffee.zip"));
I was going through the CF7 code and found where I thought the issue might be: classes.php does this:
if ( $this->uploaded_files ) { $for_this_mail = array(); foreach ( $this->uploaded_files as $name => $path ) { if ( false === strpos( $mail_template['attachments'], "[${name}]" ) ) continue; $for_this_mail[] = $path; } return @wp_mail( $recipient, $subject, $body, $headers, $for_this_mail ); }
The email would come in with just the name in the body of the email, which in the shortcode replacement part of CF7 makes sense.
I believe this is an issue with the path being added since I can replace $for_this_mail with array($_SERVER[‘DOCUMENT_ROOT’].”/wp-content/themes/thematic/coffee.zip”) and it works fine.
Thoughts?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘[Plugin: Contact Form 7] Attachment Issue’ is closed to new replies.