• 21-04-2024, 16:01:30
    #10
    DarkBy adlı üyeden alıntı: mesajı görüntüle
    kodu bi komple atar mısın?
    DarkBy adlı üyeden alıntı: mesajı görüntüle
    if($_POST){
    try{
    
    ........
    
    send();
    
    }} catch (Exception $e) {
        echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
        die();
    }
    }
    try catch yapısını komple post koşuluna almalısın. Hepsini atsaydın düzgün çalışacak kodu atardım fakat üstte bir şablon bıraktım.
    Kusuruma bakma hocam ben ilgili alanı istediğini düşündüm. Tüm alanı iletiyorum;

    try {
        //Server settings
        $mail->SMTPDebug = 0;                      //Enable verbose debug output
        $mail->isSMTP();                                            //Send using SMTP
        $mail->Host       = 'smtp.gmail.com';                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = 'xxxxx';                     //SMTP username
        $mail->Password   = 'xxxxx';                               //SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
        $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
        //Recipients
        $mail->setFrom('xxxxx', 'Destek Talebi');
        $mail->addAddress('xxxxx', 'xxxx');     //Add a recipient
        //Content
        $mail->isHTML(true);
        $mail->CharSet = "UTF-8";
        $mail->Subject = $mail_form_konu;
        $mail->Body    = $mail_icerik;
        $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
        $mail->send();
        echo 'Message has been sent';
        
    } catch (Exception $e) {
        echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
        die();
    }
  • 21-04-2024, 16:02:19
    #11
    Bu cevap, konu sahibi tarafından kabul edilebilir bir cevap olarak işaretlendi.
    mehmetkacar adlı üyeden alıntı: mesajı görüntüle
    Kusuruma bakma hocam ben ilgili alanı istediğini düşündüm. Tüm alanı iletiyorum;

    try {
        //Server settings
        $mail->SMTPDebug = 0;                      //Enable verbose debug output
        $mail->isSMTP();                                            //Send using SMTP
        $mail->Host       = 'smtp.gmail.com';                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = 'xxxxx';                     //SMTP username
        $mail->Password   = 'xxxxx';                               //SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
        $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
        //Recipients
        $mail->setFrom('xxxxx', 'Destek Talebi');
        $mail->addAddress('xxxxx', 'xxxx');     //Add a recipient
        //Content
        $mail->isHTML(true);
        $mail->CharSet = "UTF-8";
        $mail->Subject = $mail_form_konu;
        $mail->Body    = $mail_icerik;
        $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
        $mail->send();
        echo 'Message has been sent';
        
    } catch (Exception $e) {
        echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
        die();
    }
    if($_POST){
    
    try {
        //Server settings
        $mail->SMTPDebug = 0;                      //Enable verbose debug output
        $mail->isSMTP();                                            //Send using SMTP
        $mail->Host       = 'smtp.gmail.com';                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = 'xxxxx';                     //SMTP username
        $mail->Password   = 'xxxxx';                               //SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
        $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
        //Recipients
        $mail->setFrom('xxxxx', 'Destek Talebi');
        $mail->addAddress('xxxxx', 'xxxx');     //Add a recipient
        //Content
        $mail->isHTML(true);
        $mail->CharSet = "UTF-8";
        $mail->Subject = $mail_form_konu;
        $mail->Body    = $mail_icerik;
        $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
        $mail->send();
        echo 'Message has been sent';
         
    } catch (Exception $e) {
        echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
        die();
    }
    
    }
    Bu şekilde çalışacaktır.
  • 21-04-2024, 16:04:16
    #12
    DarkBy adlı üyeden alıntı: mesajı görüntüle
    if($_POST){
    
    try {
        //Server settings
        $mail->SMTPDebug = 0;                      //Enable verbose debug output
        $mail->isSMTP();                                            //Send using SMTP
        $mail->Host       = 'smtp.gmail.com';                     //Set the SMTP server to send through
        $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
        $mail->Username   = 'xxxxx';                     //SMTP username
        $mail->Password   = 'xxxxx';                               //SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
        $mail->Port       = 465;                                    //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
        //Recipients
        $mail->setFrom('xxxxx', 'Destek Talebi');
        $mail->addAddress('xxxxx', 'xxxx');     //Add a recipient
        //Content
        $mail->isHTML(true);
        $mail->CharSet = "UTF-8";
        $mail->Subject = $mail_form_konu;
        $mail->Body    = $mail_icerik;
        $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
        $mail->send();
        echo 'Message has been sent';
        
    } catch (Exception $e) {
        echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
        die();
    }
    
    }
    Bu şekilde çalışacaktır.
    Canımsın hocammm