query($query) or die("Cannot execute query"); while ($row = $result->fetch_array()) { array_push($mail_bcc, "$row[mail]"); } } if ($trenner[0] == 'C') { $query1 = "select mail from jumi_chor_saenger"; $result1 = $db->query($query1) or die("Cannot execute query1"); while ($row1 = $result1->fetch_array()) { array_push($mail_bcc, "$row1[mail]"); } } if ($trenner[0] == 'V') { $query2 = "select mail from jumi_mailverteiler a, jumi_mailverteiler_entries b, jumi_mailverteiler_user_zuord c where a.mvid=c.mvid and b.mveid=c.mveid and c.mvid=$trenner[1]"; $result2 = $db->query($query2) or die("Cannot execute query2"); while ($row2 = $result2->fetch_array()) { array_push($mail_bcc, "$row2[mail]"); } } } # Doppelte Mailadressen entfernen. Fall jemand in mehreren Gruppen aktiv ist. $mail_bcc = array_unique($mail_bcc); $mail = new PHPMailer(); try { //Server settings $mail->isSMTP(); //Send using SMTP $mail->CharSet = 'UTF-8'; $mail->Encoding = 'base64'; $mail->SMTPDebug = 0; $mail->Host = 'smtp.ionos.de'; //Set the SMTP server to send through $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = "$mailjumi"; //SMTP username $mail->Password = "$mailpwd"; //SMTP password $mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; # Priority: Options: null (default), 1 = High, 3 = Normal, 5 = low # $mail->Priority = 1; //Recipients //$mail->SetFrom($_POST["userEmail"], $_POST["userName"]); //$mail->AddReplyTo($_POST["userEmail"], $_POST["userName"]); $mail->SetFrom("$mailjumi", "$absender"); # $mail->AddAddress("$mailjumi", "$absender"); $mail->AddReplyTo("$mailjumi", "$absender"); //$mail->addCC('cc@example.com'); foreach ($mail_bcc as $empfbcc) { $mail->addBCC("$empfbcc"); } //Attachments if (sizeof($_FILES["attachment"]["name"]) > 0) { foreach ($_FILES["attachment"]["name"] as $k => $v) { $mail->AddAttachment($_FILES["attachment"]["tmp_name"][$k], $_FILES["attachment"]["name"][$k]); } } //Content $mail->isHTML(true); //Set email format to HTML $mail->Subject = $_POST["subject"]; $mail->Body = $_POST["content"]; //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); require_once("../controller/func_save_mail.php"); save_mail($mail); echo '
Mail wurde versendet!
|***|success'; } catch (Exception $e) { echo "
Es konnte keine Mail verschickt werden! Mailer Error: {$mail->ErrorInfo}
|***|error"; } ?>