dapcigar Posted May 22, 2014 Share Posted May 22, 2014 Have actually tried this mailer on localhost and it worked perfectly. Now am trying to use it on online but it's giving this error SMTP-> ERROR: Failed to connect to server: Connection timed out (110) SMTP -> ERROR: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP Host. please how do i fix this? include "classes/class.phpmailer.php"; // include the class name$mail = new PHPMailer(); // create a new object$mail->IsSMTP(); // enable SMTP$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only$mail->SMTPAuth = true; // authentication enabled$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail$mail->Host = "smtp.gmail.com";$mail->Port = 465; // or 587$mail->IsHTML(true);$mail->Username = "[email protected]";$mail->Password = "hyprops123";$mail->SetFrom("[email protected]");$mail->Subject = "Requisition Processed";$mail->Body = "<b>Hello $firstname, your requisition has been processed and Approved.. <br/><br/>Come to the Account department to recieve your $text . <br/> Thank You </b>";$mail->AddAddress($email); if(!$mail->Send()){ echo "Mailer Error: " . $mail->ErrorInfo;} Link to comment https://forums.phpfreaks.com/topic/288676-smtp-error-failed-to-connect-to-server/ Share on other sites More sharing options...
IanA Posted May 22, 2014 Share Posted May 22, 2014 First, you might want to hide the log in details for all to see... Try adding the following: $mail->SMTPSecure = "tls";$mail->Port = 587; Link to comment https://forums.phpfreaks.com/topic/288676-smtp-error-failed-to-connect-to-server/#findComment-1480435 Share on other sites More sharing options...
dapcigar Posted May 22, 2014 Author Share Posted May 22, 2014 Thanks.. will try that now Link to comment https://forums.phpfreaks.com/topic/288676-smtp-error-failed-to-connect-to-server/#findComment-1480438 Share on other sites More sharing options...
jazzman1 Posted May 22, 2014 Share Posted May 22, 2014 Before to try doing anything with this library, make sure the remote machine has installed a ssl php support itself. Link to comment https://forums.phpfreaks.com/topic/288676-smtp-error-failed-to-connect-to-server/#findComment-1480446 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.