Jump to content
Fórum Script Brasil
  • 0

erro ao conectar ao servidor SMTP

Rômulo Marques Pereira


Eu estou tendo dificuldade em conectar o servidor do gmail pois toda vez aparece essa mensagem

 SMTP connect() failed.

Quem poder me ajudar.

$mail->isSMTP();                                        //    Set mailer to use SMTP        
            $mail->Host = 'smtp.gmail.com';                            //    Specify main and backup SMTP servers
            $mail->SMTPAuth = true;                                 //    Enable SMTP authentication
            $mail->Username = '[email protected]';            //    SMTP username
            $mail->Password = 'senha';                            //    SMTP password                        
            $mail->SMTPSecure = 'tls';                                //    Enable TLS encryption, `ssl` also accepted
            $mail->Port = 587;                                        // TCP port to connect to

            $mail->setFrom('[email protected]', 'Rômulo');            
            $mail->addAddress('[email protected]', 'Rômulo');        //    Add a recipient
            //$mail->addReplyTo('[email protected]', 'Information');        
            //$mail->addCC('[email protected]');
            //$mail->addBCC('[email protected]');

            //$mail->addAttachment('/var/tmp/file.tar.gz');            //     Add attacments
            //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    //    Optional name
            $mail->isHTML(true);                                    // Set email format to HTML

            $mail->SMTPDebug = 2;
            $mail->Subject = 'Assunto email';
            $mail->Body    = 'Corpo do meu <b>email</b>';
            $mail->AltBody = 'Corpo do meu email';

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...