bagaimana ya caranya supaya webnya gk keredirect ke laman php??..

jadi aku pakai phpmailer dan untuk validasi terkirimnya aku pakai sweet aler.. untuk sweet alernya bekerja, nah tapi kenapa malah keredireect ke laman debugging phpnya??

tanya.jpg42.25 KB

<?php

    // echo !extension_loaded('openssl')?"Not Available":"Available";

    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\Exception;
    // use PHPMailer\PHPMailer\SMTP;

    //Load composer's autoloader
    require 'vendor/autoload.php';
    require 'src/PHPMailer.php';
    require 'src/SMTP.php';
    require 'src/Exception.php';
    require 'src/POP3.php';
    require 'src/OAuth.php';




    $mail = new PHPMailer(true);

    try {
        //Server settings
        $mail->SMTPDebug = 2;                      // 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   = 'rabildarmawan@gmail.com';                     // SMTP username
        $mail->Password   = '*******';                               // SMTP password
        $mail->SMTPSecure = 'tls';         // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
        $mail->Port       = 587;                                    // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above

        //Recipients
        $mail->setFrom('no-reply@gmail.com');
        $mail->addAddress("darmawanrabil@gmail.com");     // Add a recipient
        // $mail->addAddress('darmawanrabil@gmail.com');               // Name is optional
        // $mail->addReplyTo($_GET['email']);
        // $mail->addCC('darmawanrabil@gmail.com');
        // $mail->addBCC('darmawanrabil@gmail.com');

        // Attachments
        // $mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
        // $mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name

        // Content
        $mail->isHTML(true);                                  // Set email format to HTML
        $mail->Subject = 'PORTOFOLIO';
        $mail->Body    = $_POST['pesankomentar'];
        // $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';


        $mail->send();
        echo "
        <script src='sweetalert2/dist/sweetalert2.min.js'></script>
        <link rel='stylesheet' href='sweetalert2/dist/sweetalert2.min.css'>
        <script src='https://cdn.jsdelivr.net/npm/sweetalert2@9'></script>
        <script type='text/javascript'>
            Swal.fire(
                'Berhasil Mengirim Komentar',
                'Terima Kasih ^^',
                'success'
            )
        </script>";
    } catch (Exception $e) {
        exit();
        echo "
        <script src='https://cdn.jsdelivr.net/npm/sweetalert2@9'></script>
        <script type='text/javascript'>
            Swal.fire({
                icon: 'error',
                title: 'Gagal mengirim pesan',
                text: 'silahkan lapor melalui media sosial',
                footer: '<a href>Why do I have this issue?</a>'
            })
        </script>";
    }
?>
avatar RabilDarmawan
@RabilDarmawan

25 Kontribusi 2 Poin

Diperbarui 4 tahun yang lalu

1 Jawaban:

<div>Set nilai smtpdebug ke 0</div><pre>//Server settings $mail-&gt;SMTPDebug = 0;</pre><div><br><br>Referensi :<br><a href="https://stackoverflow.com/questions/30771821/how-to-disable-phpmailer-showing-configuration-details-on-browser#:~:text=2%20Answers&amp;text=You%20can%20set%20%24phpmailer%2D%3E,to%20prevent%20showing%20debug%20messages.">https://stackoverflow.com/questions/30771821/how-to-disable-phpmailer-showing-configuration-details-on-browser#:~:text=2%20Answers&amp;text=You%20can%20set%20%24phpmailer%2D%3E,to%20prevent%20showing%20debug%20messages.</a></div>

avatar ahanafi
@ahanafi

815 Kontribusi 554 Poin

Dipost 4 tahun yang lalu

Login untuk ikut Jawaban