Fredy Marin
Fredy Marin

Reputation: 11

Return several message PHPMailer

Today have next error. I create one object PHPMailer where an user do register and the aplication send mail notification. I implement ajax to return data type json, but always receive several message.

SERVER -> CLIENT: 220 smtp.gmail.com ESMTP 5sm1094881uae.18 - gsmtp
CLIENT -> SERVER: EHLO localhost
SERVER -> CLIENT: 250-smtp.gmail.com..............................................................................................many lines.

My code is:

in the view:

 $.ajax({
                    url:'../controller/loginController.php?register=true',
                    type: 'post',
                    dataType: 'json',
                    data: data,
                    success: function(data) {
                        if(data.response != "true") {
                            $('#submitRegister').removeProp("disabled");
                            $('#response-message').text(data.message);
                            $("#btn-message").trigger("click");

                        }else{
                            if (data.response == null){
                            $('#submitRegister').removeProp("disabled");
                            document.getElementById("form-register").reset();
                            $('#response-message').text("El curso fue creado correctamente");
                            $("#btn-message").trigger("click");
                            }
                        }
                    }
                })

in the class php:

if (!$mail->send()) {
            return false; // "Mailer Error: " . $mail->ErrorInfo;
        } else {
            return true;
        }

Upvotes: 0

Views: 163

Answers (1)

Alexey Chuhrov
Alexey Chuhrov

Reputation: 1787

I think you have SMTP debug turned on. Thats really looks like SMTP logging. Try:

$mail->SMTPDebug = false;

Also: Disable PHPMailer error messages

Upvotes: 1

Related Questions