I have Found Error to send mail in PHP using phpmailer Library.any one can answer this Error. Thank you.
smtp connect() failed. https://github.com/phpmailer/phpmailer/wiki/troubleshooting
require_once APPPATH.'third_party/phpmailer/class.phpmailer.php';
require_once APPPATH.'third_party/phpmailer/class.smtp.php';
$rtn = false;
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->Username = 'myemail@gmail.com';
$mail->Password = 'mypassword';
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->AddAddress($email);
$mail->SetFrom('myemail@gmail.com', 'Smart Saver Support');
$mail->AddReplyTo('myemail@gmail.com', 'Smart Saver Support');
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->MsgHTML($msg);
$rtn = $mail->Send();
return $rtn;