Thanks for your reply.
$file_path is an array of complete urls.
Here is a more complete snippet
$subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
$attachments = array();
foreach ($file_paths as $file_path) {
$attachments[] = $file_path;
}
// Générer un délimiteur
$boundary = md5(time());
// En-têtes de l'e-mail
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-Type: multipart/mixed; boundary="' . $boundary . '"';
$body = '--' . $boundary . "\r\n";
$body .= 'Content-Type: text/html; charset=UTF-8' . "\r\n";
//$body .= 'Content-Transfer-Encoding: 7bit' . "\r\n\r\n";
$body .= $message . "\r\n\r\n";
foreach ($attachments as $attachment) {
$file_content = file_get_contents($attachment);
$file_encoded = base64_encode($file_content);
$body .= '--' . $boundary . "\r\n";
$body .= 'Content-Type: application/pdf; name="' . basename($attachment) . '"' . "\r\n";
$body .= 'Content-Transfer-Encoding: base64' . "\r\n";
$body .= 'Content-Disposition: attachment; filename="' . basename($attachment) . '"' . "\r\n\r\n";
$body .= chunk_split($file_encoded) . "\r\n\r\n";
}
$body .= '--' . $boundary . '--';
return wp_mail($to, $subject, $body, $headers);