Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to send email with attachment but, I am not getting any attachment but I am getting the email bellow is the function ,I have used in function.php and I am trying to attach a zip file fro upload folder.

<?php 
$to='sanjaynakate@gmail.com';
$subject='etc';
$message='etc';
$headers='etc';
move_uploaded_file($_FILES["attachment"]["tmp_name"],WP_CONTENT_DIR .'/uploads/'.basename($_FILES['attachment']['file_to_attach.zip']));
$attachments = array(WP_CONTENT_DIR ."/uploads/".$_FILES["attachment"]["file_to_attach.zip"]);
wp_mail($to, $subject, $message, $headers, $attachments);
?>
share|improve this question
    
The name of the destination file in the move_uploaded_file() function should probably match the name of the file in the $attachments array. You used the basename() function in the former, but not in the latter. –  Charles Clarkson Nov 12 '13 at 8:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.