Merhabalar,
Ben textarea ile alt alta toplu mailler sistemi yapmaya çalışıyorum fakat bir hata aldım çözemedim. Yardımcı olursanız sevinirim.


use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

if(isset($_POST['submit'])) {
// Gelen veriyi satır satır array'a alalım.
$mailler = explode("\n", str_replace("\r", "", $_POST['pesan']));
 

foreach ($mailler as $mail) {
Mailgonder($mail);
}



require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';  




    $mail = new PHPMailer(true);

    try {
    //Server settings-
    $mail->SMTPDebug = 0;                      //Enable verbose debug output
    $mail->isSMTP();                                            //Send using SMTP
    $mail->Host       = 'mail.privateemail.com';                     //Set the SMTP server to send through
    $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
    $mail->Username   = "";                     //SMTP username
    $mail->Password   = "";                               //SMTP password
    $mail->SMTPSecure = 'tls';            //Enable implicit TLS encryption
    $mail->Port       = 587;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

    //pengirim
    $mail->setFrom('"deneme@deneme.com', 'test');
    $mail->addAddress($mailler);    //Add a recipient

    //Content
    $mail->isHTML(true);                                  //Set email format to HTML
    $mail->Subject = $_POST['judul'];
    $mail->Body    = "test";
    $mail->AltBody = '';
    //$mail->AddEmbeddedImage('gambar/logo.png', 'logo');
    //$mail->addAttachment('');

    @$mail->send();
    return 'Message has been sent';
} catch (Exception $e) {
    return "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";

}


}

?>