0
我有一個帶有文件上傳字段的聯繫人表單(CV上傳)。WordPress發送帶有上傳附件的郵件
但是我可以通過郵件和郵件發送沒有問題,但我從網上使用的示例附上表格中的簡歷不起作用。
有什麼我在這裏失蹤?
<input type="text" name="fullName" placeholder="Full Name: (required)" required>
<input type="email" name="email" placeholder="Email: (required)" required>
<input type="tel" name="tel" placeholder="Telephone: (required)" required>
<textarea name="message" placeholder="Quick message"></textarea>
<span>Please upload a copy of your cv</span><span><input type="file" name="cv" required></span>
//Handle the file upload and attachment
if (! function_exists('wp_handle_upload')) {
require_once(ABSPATH . 'wp-admin/includes/file.php');
}
$uploadedfile = $_FILES['cv'];
$upload_overrides = array('test_form' => false);
$movefile = wp_handle_upload($uploadedfile, $upload_overrides);
if ($movefile && ! isset($movefile['error'])) {
$movefile['url'];
}
$attachments = array($movefile['file']);
$mailoffice = wp_mail('[email protected]', 'New Candidate Application', $messageOffice, $headers, $attachments);
定義「不工作」 – Synchro
郵件將從窗體中發送所有消息內容和發佈的值。但是,文件附件的PHP不包括附件。 –
很確定'wp_mail'只需要一個文件名的數組......'wp_handle_upload'返回的是不同的東西。 – CBroe