Hello there!
I’m currently working on a website for a while. It is used in an institution for employee training. They can registrate to courses, we can manage places, content, datetime and so on.
When a registration is made, people receive an email with validation and an ICS file. Our “teachers” have a setting to be in copy of these emails.
However, this option was functionnal a few weeks ago and now… It’s like wp\_mail is ignoring Cc, but still attach ICS file.
I tried to :
* Disable all plugins that are not necessary
* Enable debug mode, manually enable error\_log
* Change teachers, try 3 or 4 different courses, use test accounts…
* Change SMTP configuration
​
Here is some technical informations
* IIS Webserver
* WordPress up-to-date, v. 6.4.2
* Plugins up-to-date
* Advanced Custom Field Pro, v. 6.2.4
* Custom Post Type, v. 1.15.1
In addition, you can see there some logs and corresponding source code.
\[08-Dec-2023 17:36:56 UTC\] Before sending email: Array(\[0\] => do\_action(‘wp\_ajax\_updateRegistration’), WP\_Hook->do\_action, WP\_Hook->apply\_filters, updateRegistration, updateRegistrationEmail\[1\] => \*\*\*\*@\*\*\*.\*\*\* // My email, as a new registration\[2\] => \[Formations internes\] Inscription au cours #1476 – Accueil d’un-e collaborateur-trice – Présentation et utilisation des ressources informatiques\[3\] => <table> \[full email content\] </table>\[4\] => Cc: Raymond.\*\*\*\*@\*\*\*\*.\*\*\*\*; // The teacher’s email, exactly as I need…\[5\] => E:\\\[…\]MyCourse.ics)
​
// Envoi d’un email à chaque (dés)inscription
function updateRegistrationEmail($id, $registerId, $isRegistered) {
$registeredEmail = get_userdata($registerId)->user_email;
$post = getCourseFields($id);
$emailHeader = createEmailHeader();
$emailInfos = createEmailBodyRegistration($post, $registerId, $isRegistered);
$emailFooter = createEmailFooter($post);
$fullBody = $emailHeader . $emailInfos[‘content’] . $emailFooter;
$icsFileUri = $isRegistered ? createAttachedICS($id) : null;
// On génère le sujet du mail
$object = “[Formations internes] “;
$object .= $isRegistered ? “Inscription ” : “Désinscription “;
$object .= “au cours #$id – {$post->formation[0]->post_title}”;
add_filter( ‘wp_mail_content_type’, ‘wpdocs_set_html_mail_content_type’ );
error_log(‘Before sending email: ‘ . print_r(array(wp_debug_backtrace_summary(), $registeredEmail, $object, $fullBody, $emailInfos[‘headers’], $icsFileUri), true));
// On envoie le mail
$result = wp_mail($registeredEmail, $object, $fullBody, $emailInfos[‘headers’], $icsFileUri);
remove_filter( ‘wp_mail_content_type’, ‘wpdocs_set_html_mail_content_type’ );
// On supprime l’invitation ICS créée sur le serveur une fois le mail envoyé
unlink($icsFileUri);
}
Does anything sound wrong with that?
Because, as I said, everything looks fine but the Cc users…
​
Thanks in advance! And obviously, if you need any more information, just let me know. 🙂
[ad_2]