Jump to content

Recommended Posts

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 = "hypropsict@gmail.com";
$mail->Password = "hyprops123";
$mail->SetFrom("hypropsict@gmail.com");
$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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.