mdreyfus
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Plugins
In reply to: [WP Mail Logging] Logging stop working with MultiPart emailVersion 1.12.0
The initial subject : Sample – Appel à cotisation 2024Forum: Plugins
In reply to: [WP Mail Logging] Logging stop working with MultiPart emailEmail and attachment files are sending, but don’t appear in Email Logging…
Forum: Plugins
In reply to: [WP Mail Logging] Logging stop working with MultiPart emailThanks 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);
Viewing 3 replies - 1 through 3 (of 3 total)