Failed to send email with phpmailer

Asked

Viewed 100 times

0

I use the PHPMAILER on another site of mine where it is working perfectly. However, that same code does not allow me to send emails, it gives Sucesso and no error appears. I used the code $mail->SMTPDebug = 2; and I can find no mistake there.

Here’s the code

require 'mail/PHPMailerAutoload.php';
    $mail = new PHPMailer();
    $mail->IsSMTP();   
    $mail->SMTPDebug = 2;  
    $mail->Host = "servidor";  //nome do servidor está oculto
    $mail->Port = 587;
    $mail->SMTPAuth = false;
    $mail->CharSet="utf-8";

    $mail->From = "email1";
    $mail->FromName = "Nome1";
    $mail->AddAddress("email2");
    $mail->IsHTML(true);

    $mail->Subject = "Taasd";
    $mail->Body    = $titulo;

    if(!$mail->Send()){
       echo "<script>console.log('".$mail->ErrorInfo."')</script>";
       exit;
    }else{
        echo "<script>console.log('Sucesso')</script>";
    } 
  • You are using port 587 and Smtpauth false !?

  • @RBZ Uhhhh yes, I did something wrong?

1 answer

1


Today are rare the servers that send without authentication. If your really accepted, would be port 25.

If you do not accept, you will have to set the user and password.

Example of structure and debug:

Failed to read a. php file (lib Phpmailer)

  • The way I put the debug it showed the whole process and indicated no errors

  • Test as example. Let’s make it work !

  • Uncaught Error: Call to Undefined method SMTP:DEBUG_SERVER()

  • Take a look at the link in my reply. I’m on the cell it’s hard to keep editing answer.

  • Gives exactly the same text as the $mail->SMTPDebug = 2;

  • Thanks for your help, I decided to use SMTPAuth + credentials and it sends as it is supposed, I could not use without authentication

  • Your email server probably won’t accept it. I’m glad you solved it ! :]

  • I must delete the question?

  • But my answer didn’t help you ? If yes, put it as solved, if you can’t erase.

  • Using authentication as referred by you solved the problem

Show 5 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.