Like I mentioned in a previous question, I want to send an email attachment dynamically when a user gives me there contact details.
I started with the absolute url:
get_template_directory().'/test.pdf'
This works fine, but when I try to reference a file in my uploads folder, it does not work.
Is contact form 7 unable to access my uploads folder?
Okay, so here's my code:
add_action( 'wpcf7_before_send_mail', 'send_pdf' );
function send_pdf( $cf7 ) {
$id = $cf7->id();
if ($cf7->id==1308){
$submission = WPCF7_Submission::get_instance();
$submission->add_uploaded_file('pdf', 'http://ift.tt/1D3JMYG');
}
}
The url here does not want to work, I get an email but no pdf, with the other url though it works fine.
What gives?
Aucun commentaire:
Enregistrer un commentaire