PHP Mailer Results In Timeout

Greetings,

I’ve used PHPMailer for the past 6 years with little issue. We’re on a new dedicated server which seems otherwise awesome but loading up a standalone phpmailer install results in the browser “loading” spinner and never sends.

I’m particularly trying to route through google just for the sake of this particular development.

The spinner is a result of both my custom scripting and I’ve confirmed it in the DEFAULT example code that comes with phpmailer. If you take out $mail->send() the page reloads immediately but is blank. If you put $mail->send() back in it spins and spins and spins.


<html>
<head>
<title>PHPMailer - SMTP basic test with authentication</title>
</head>
<body>

<?php

//error_reporting(E_ALL);
error_reporting(E_STRICT);

date_default_timezone_set('America/Toronto');

require_once('includes/phpmailer_full/class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail             = new PHPMailer();
$body = 'test';

$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages only
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "smtp.gmail.com"; // sets the SMTP server
$mail->Port       = 465;                    // set the SMTP port for the GMAIL server
$mail->Username   = "jon@hiddendomain.com"; // SMTP account username
$mail->Password   = "adsflkjasdf";        // SMTP account password


$mail->Subject    = "PHPMailer Test Subject via smtp, basic with authentication";

$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);

$address = "jon@hiddenendomain.com";
$mail->AddAddress($address, "jon");

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}

?>

</body>
</html>

I was trying PHPMailer Lite but received issues with it not being able to find /usr/sbin/sendmail which is the correct path and seemingly correct permissions.

Any help is greatly appreciated.

Have you tried it without using SMTP, using sendmail instead? Do you see anything if you change the debug level to 1? What happens if you use the standard PHP function mail() to send a test email?

Without SMTP this is what I get.

Mailer Error: Could not instantiate mail function.

For what it’s worth my sendmail_from ini is set to “no value”