isSMTP(); #$phpmailer->Host = $smtp_host; #$phpmailer->Port = $smtp_port; #$phpmailer->SMTPAuth = true; #$phpmailer->Username = $smtp_username; #$phpmailer->Password = $smtp_password; $phpmailer->setFrom('info@pfingstlager-24.de', "KoPfiLa '24 - Die Lagerleitung"); #$phpmailer->SMTPSecure = $smtp_secure; } ); $unfiltered_mails = explode(',', str_replace(';', ',', $_REQUEST['mail-to'])); $mail_to = array(); foreach ($unfiltered_mails as $recipient) { $recipient = trim($recipient); if (!in_array($recipient, $mail_to)) { $mail_to[] = $recipient; } } foreach ($mail_to as $mail_to_line) { if (str_contains($mail_to_line, '<')) { $pattern = '/^(.*)<(.*)>$/'; if (preg_match($pattern, $mail_to_line, $matches)) { $name = trim($matches[1]); // Name $email = trim($matches[2]); // E-Mail-Adresse $content = str_replace('[anrede]', 'Hallo ' . $name . ',', $_REQUEST['mail-text']); $content = str_replace('[name]', $name, $content); $content = nl2br($content); $sent = wp_mail($email, $_REQUEST['mail-subject'], $content, ['Reply-To: ' . $_REQUEST['mail-from'], 'Content-Type: text/html; charset=UTF-8']); // Überprüfen, ob die E-Mail erfolgreich gesendet wurde if ($sent) { kompass_print_message_box(__('Mail sent to', BDP_LV_PLUGIN_SLUG) . ': ' . $email); } else { kompass_print_message_box(__('Mail failed to sent to', BDP_LV_PLUGIN_SLUG) . ': ' . $email, 'error'); } } } else { $sent = wp_mail($_REQUEST['mail-to'],$_REQUEST['mail-subject'], $_REQUEST['mail-text'], ['Reply-To: ' . $_REQUEST['mail-from'], 'Content-Type: text/html; charset=UTF-8']); // Überprüfen, ob die E-Mail erfolgreich gesendet wurde if ( $sent ) { kompass_print_message_box(__('Mail sent to', BDP_LV_PLUGIN_SLUG) .': ' . $_REQUEST['mail-to']) ; } else { kompass_print_message_box(__('Mail failed to sent to', BDP_LV_PLUGIN_SLUG) .': ' . $_REQUEST['mail-to'], 'error') ; } } } } }