php - SMTP Connect() failed. Message was not sent.Mailer error: SMTP Connect() failed -


am trying send mail gmail address keeps on getting error "smtp -> error: failed connect server: connection timed out (110)smtp connect() failed. message not sent.mailer error: smtp connect() failed." problem?

        require 'class.phpmailer.php'; // path phpmailer class         require 'class.smtp.php';              $mail = new phpmailer();               $mail->issmtp();  // telling class use smtp             $mail->smtpdebug = 2;             $mail->mailer = "smtp";             $mail->host = "ssl://smtp.gmail.com";             $mail->port = 587;             $mail->smtpauth = true; // turn on smtp authentication             $mail->username = "myemail@gmail.com"; // smtp username             $mail->password = "mypasswword"; // smtp password              $mail->priority = 1;              $mail->addaddress("myemail@gmail.com","name");             $mail->setfrom($visitor_email, $name);             $mail->addreplyto($visitor_email,$name);              $mail->subject  = "message  contact form";             $mail->body     = $user_message;             $mail->wordwrap = 50;                if(!$mail->send()) {             echo 'message not sent.';             echo 'mailer error: ' . $mail->errorinfo;             } else {             echo 'message has been sent.';             } 

remove or comment out line-

$mail->issmtp(); 

and work you.

i have checked , experimented many answers different sites haven't got solution except above solution.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -