Jump to content

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


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   = "test@outlook.com"; 
    $m->Password   = "pass";
    $m->SMTPSecure = 'tls';
    $m->Port       = 465;  // ive also tried 587
    $m->From       = "test@outlook.com"; 
    $m->FromName   = "test@outlook.com"; 
    $m->addReplyTo('test@outlook.com ','Reply Address');
    $m->addAddress('test@outlook.com', '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

Edited by sKunKbad

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.

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.