I am trying to use PHPMailer to connect through an Exchange server. I have tried several suggested ports and finally got a reaction on 587. I have run a port scan via Apple's Network Utility on the smtp server and haven't returned anything. Anyway, here's the code unashamedly stolen:
require '/Users/tim/sites/PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 1;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.suddenlink.com; smtp2.suddenlink.com'; // Specify main and backup server
$mail->Port = 587;
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'exchangeserver\t***s'; // SMTP username
$mail->Password = 'J****2'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->From = 'timothy.stringer@suddenlink.com';
$mail->FromName = 'Timothy Stringer';
$mail->addAddress('timstring@mac.com', 'tim'); // Add a recipient
//$mail->addAddress('ellen@example.com'); // Name is optional
$mail->addReplyTo('timothy.stringer@suddenlink.com', 'Timothy Stringer');
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');
$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->addAttachment($FileOut); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
echo 'Message has been sent';
I am getting the following errors:
Failed to connect to server: Operation timed out (60)
&
Failed to connect to server: Connection refused (61)
I cannot find any information on those two errors. What do they mean? Is there a way to tell why the connection was refused?
thanks,
tim