Jump to content

Failed to connect socket


tanvirtonu

Recommended Posts

 

Failed to connect socket

I have written a simple php mailing script using mail peer. My code is as follows-

PHP Code:

<?php
require_once "Mail.php";
$from = "TAnvir Sender <[email protected]>";
$to = "Tonu Recipient <[email protected]>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "ssl://smtp.mail.yahoo.com";
//$host = "smtp.mail.yahoo.com";

$port='465';
$username = "bhonest_4ever2007";
$password = "abcdefg";

$headers = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);
$smtp = Mail::factory('smtp',
  array ('host' => $host,
      'port' => $port,
    'auth' => true,
    'username' => $username,
    'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
  echo("<p>" . $mail->getMessage() . "</p>");
} else {
  echo("<p>Message successfully sent!</p>");
}
?>

Now I mgetting this error-

"Failed to connect to ssl://smtp.mail.yahoo.com:465 [sMTP: Failed to connect socket: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (code: -1, response: )] "

 

Pls help me.I m using an installer of Apache, MySQL and PHP for Windows called XAMPP 1.6.4 which is a Apache distribution for windows.I dont know how to recompile php with ssl. Bcos all I did to install php is I just installed Xampp installer.It did the rest.Help me.

Reply With Quote Quick reply to this message

 

Link to comment
https://forums.phpfreaks.com/topic/77274-failed-to-connect-socket/
Share on other sites

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.