Lef
Lef

Reputation: 53

phpmailer send function does not return a value

I have this piece of code here and phpmailer send function does not return true or false so the following is not working. JSON is ok and tested on other functions. I pinpointed the problem on mail->send. Mail is working and is sent to the email address but I do not get a return value. The code is a php file called form jquery as an ajax call. If anybody can help thanks in advance.

    if( !$mail->Send() )
{
    // return 0 for failure
    $data[] = array("result" => 0 );
}
else
{
    // return 1 for success
    $data[] = array("result" => 1 );
}

Upvotes: 0

Views: 2812

Answers (1)

Lef
Lef

Reputation: 53

if you have a similar problem just disable line $mail->isSMTP(); and its working

Upvotes: 1

Related Questions