Jump to content

PHP Mailer Script timing out in Outlook , but not in Gmail.


whitt

Recommended Posts

Hi guys , my script works perfectly in Gmail however  i now need it to work in Outlook , when the form is submitted i get this error.

 

2014-10-25 18:49:00 SMTP ERROR: Failed to connect to server: Connection timed out (110) 2014-10-25 18:49:00 SMTP connect() failed. Mailer Error: SMTP connect() failed.

 

 

<?php
 
 
require("../lib/phpmailer/PHPMailerAutoload.php");
 
if(empty($_POST['name'])        ||
   empty($_POST['email'])       ||
   empty($_POST['phone']) ||
   empty($_POST['message']) ||
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
   {
    echo "No arguments Provided!";
    return false;
   }
 
    $m             = new PHPMailer();
    $m->IsSMTP();
    $m->SMTPAuth   = true;
    $m->SMTPDebug  = 2;                    
    $m->Host       = "smtp.live.com";
   
                      
                     
    $m->Username   = "[email protected]"; 
    $m->Password   = "pass";
    $m->SMTPSecure = 'tls';
    $m->Port       = 465;  // ive also tried 587
    $m->From       = "[email protected]"; 
    $m->FromName   = "[email protected]"; 
    $m->addReplyTo('[email protected] ','Reply Address');
    $m->addAddress('[email protected]', 'Some Guy');
 
    $name = $_POST['name'];
$email_address = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
 
    
    $m->Subject = $subject;
    $m->Body = "You have received a new message. <br><br>".
                  " Here are the details:<br> Name: $name <br> Phone Number: $phone <br>".
                  "Email: $email_address<br> Message <br> $message";
    $m->AltBody = "You have received a new message. <br><br>".
                  " Here are the details:<br> Name: $name <br> Phone Number: $phone <br>".
                  "Email: $email_address<br> Message <br> $message";
 
if(!$m->Send()) {
      echo "Mailer Error: " . $m->ErrorInfo;
    } else {
      echo "Message sent!";
      return true;  
    }
 
?>

Your comment makes it appear that you are not sure if the port is correct. Perhaps the documentation for outlook would let you know. I'm seeing online that it is 587.

 

Take a look at this:

http://subinsb.com/send-mails-via-smtp-server-gmail-outlook-php

Your comment makes it appear that you are not sure if the port is correct. Perhaps the documentation for outlook would let you know. I'm seeing online that it is 587.

 

Take a look at this:

http://subinsb.com/send-mails-via-smtp-server-gmail-outlook-php

 

Already tried both ports , i get exactly the same error.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.