Jump to content
Fórum Script Brasil
  • 0

erro ao conectar ao servidor SMTP


Question

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 post
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.

Guest
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
      148690
    • Total Posts
      644529
×
×
  • Create New...