Page 1 of 1

Failed to connect socket

Posted: Tue Nov 13, 2007 7:47 am
by tanvirtonu
I have written a simple php mailing script using mail peer. My code is as follows-

Code: Select all

<?php
require_once "Mail.php";
$from = "TAnvir Sender <bhonest_4ever2007@yahoo.com>";
$to = "Tonu Recipient <tanvirtonu@yahoo.com>";
$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.

Posted: Tue Nov 13, 2007 8:13 am
by phpBuddy
hi

A question.
Who is your ISP internet provider?

Because this is domain of the smpt server you should use.

I have a broadband internet from my provider
and I send mail through the SMTP server of my ISP.
Just because I have an email account at hotmail or yahoo or http://www.operamail.com
this doesnt mean I can use them for my smtp send mail scripts.

Posted: Tue Nov 13, 2007 10:52 am
by feyd
The error suggests your build of PHP does not have OpenSSL installed.

Posted: Wed Nov 14, 2007 2:23 am
by tanvirtonu
phpBuddy wrote:hi

A question.
Who is your ISP internet provider?

Because this is domain of the smpt server you should use.

I have a broadband internet from my provider
and I send mail through the SMTP server of my ISP.
Just because I have an email account at hotmail or yahoo or http://www.operamail.com
this doesnt mean I can use them for my smtp send mail scripts.
If [s]u[/s] you [s]r[/s] are right then how can we read and write message using a mail client. I dont use the server and port no. of my ISP in my mail client.Still I can read and write message in yahoo mail by using their smtp and port(ssl). They work the same way as my script is doing. Why should I only depend on my ISP's smtp server ? What if I leave my area/country?As fas as I know , if [s]u[/s] you have any valid account in a server, [s]u[/s] you can use it from anywhere with that server name and that port.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.

Re:

Posted: Tue Apr 01, 2008 5:10 pm
by thaynejo
I realize that I am bumping an old post that has probably been resolved. However, I feel that this is a common enough question, that I thought an answer would be good.
tanvirtonu wrote:If you are right then how can we read and write message using a mail client. I dont use the server and port no. of my ISP in my mail client.Still I can read and write message in yahoo mail by using their smtp and port(ssl). They work the same way as my script is doing. Why should I only depend on my ISP's smtp server ? What if I leave my area/country?As fas as I know , if you have any valid account in a server, you can use it from anywhere with that server name and that port.
Many ISP's have started doing what is known as SMTP blocking. In fact, it is rare now to find an ISP that does NOT do it. What occurs during SMTP blocking, is that the ISP directs ALL SMTP traffic through its mail servers. The purpose of doing this is to cut down on spam. If you are not authenticated through the ISP's SMTP server, you will not be able to send mail while connected to that ISP.

For example, my ISP is Verizon. When I am at home, I have to have my Outlook configured to use Verizon's SMTP server even though I do not use my Verizon email at all. When I go to my parent's home, they have Wild Blue as their ISP. I have to configure the Outlook on my laptop to use my their SMTP server.

This can get real annoying really fast if you travel a lot, but you can thank your local SPAM retailer for ISP's having to do this.

Anyway, I hope that answers some questions people may have about this.

Again, sorry about bumping the old post.