I try to google all the morning and i think i need Stackoverflow now!
I wrote a simple script to send a mail (from hotmail to gmail) but i get this error:
SMTP -> ERROR: Failed to connect to server: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060)SMTP Connect() failed. Error
This is the code:
<?php
require_once("../includes/phpMailer/class.phpMailer.php");
require_once("../includes/phpMailer/class.smtp.php");
$to_name = "RECEIVER NAME";
$to = "[email protected]";
$subject = "Mail test at " . strftime("%T", time());
$message = "This is a test message";
$message = wordwrap($message, 70);
$from_name = "MY NAME";
$from = "[email protected]";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->Host = "smtp.live.com";
$mail->Port = 25;
$mail->SMTPAuth = true;
$mail->Username = "MY USERNAME (hotmail)";
$mail->Password = "MY PASSWORD (hotmail)";
$mail->FromName = $from_name;
$mail->From = $from;
$mail->AddAddress($to, $to_name);
$mail->Subject = $subject;
$mail->Body = $message;
$result = $mail->Send();
echo $result ? 'Sent' : 'Error';
?>
Another info is that not even the standard mail() function worked, and checking php info i found this:
sendmail_from - MY PROPER MAIL (hotmail)
sendmail_path - no value
SMTP - localhost
smtp_port - 25
Thank you!!
I believe port 25 is blocked on smtp.live.com. I cannot connect to smtp.live.com:25 from here either. Try using port 587 instead, with TLS. So, it would be:
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
I found a solution for this problem, try this
Check whether your PHP is using openSSL extension or not...!
Hope this method shall solve your problem...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With