error:
Mail error SMTP Error: Could not connect to SMTP host.

i think its bc of mail->port=465. but iam not sure.

                    $mail = new PHPMailer();
                    $mail->IsSMTP(); 
                    $mail->SMTPAuth   = true;                  // enable SMTP authentication
                    $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
                    $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
                    $mail->Port       = 465;                   // set the SMTP port for the GMAIL server
                    $mail->Username = "a@gmail.com";    //yourname@yourdomain
                    $mail->Password = "fe";           //password

                    //to
                    $mail->AddAddress($email_p, $user_name_p); //to:    
                    //subject
                    $mail->Subject = "Forgot password";
                    //html body
                    $mail->IsHTML(true);
                    $mail->Body = "HEllo $first_name_db,<br/>Your password are $password_db";
                    //from
                    $mail->From = "a@gmail.com";
                    $mail->FromName = "a";
                    $mail->wordWrap = 50;

                    //send
                    if(!$mail->send())
                    {
                        $forgot_error .= "Mail error ".$mail->ErrorInfo;
                    }

also what is wordwrap= 50 means?

where is your site hosted? its blocked from some shared hosting providers (godaddy)

word wrap limits your line length wraps to next live after 50 words

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.