Jump to content


Photo

Pear mail & SSL


  • Please log in to reply
2 replies to this topic

#1 Steve

Steve

    Newbie

  • Member
  • Pip
  • 2 posts
  • Main OS: Windows Vista

Posted 01 January 2008 - 10:51 PM

Reference the following code segment...

require_once "Mail.php";

$host = "ssl://smtp.att.yahoo.com"; //as directed from AT&T
$port = "465"; // as directed from AT&T
.
.
.
$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>");

This produces the error ...

Failed to connect to ssl://smtp.att.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: )]

I have searched through the PHP docs for any mention of SSL enable with no luck. I also searched Pear, again with no luck.

One more item that may be of significance, I am running this on 'localhost', not on an external server. Does that have any effect?

Any advice will be greatly appreciated
Thanks
Steve Albrecht
}

#2 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 02 January 2008 - 01:26 PM

You need to enable SSL support in PHP, I have never done this hence cannot provide a step-by-step guide. However the following is a very rough guide.

1) You need to download a full copy of PHP this allows you to pick-up the file php_openssl.dll place this in folder *\Uniform Server\udrive\usr\local\php\extensions

2) Enable this extension in php.ini located in folder *\Uniform Server\udrive\usr\local\php by changing this line

;extension=php_openssl.dll
To
extension=php_openssl.dll

3) Check out this page http://us.php.net/openssl to add open ssl

All the best
Ric

#3 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 02 January 2008 - 04:56 PM

I have taken a look at the files you need they are php_openssl.dll, libeay32.dll and ssleay32.dll you must use php_openssl.dll version 5.2.3.3

libeay32.dll and ssleay32.dll must match each other and be the latest versions otherwise you will receive an ordinal 3879 error.

I have done the legwork for you see attachment ssl_php.exe save to any folder; double click on the file to extract files.

Copy the files to the folders as shown below:
php_openssl.dll to folder *\Uniform Server\udrive\usr\local\php\extensions
libeay32.dll to folder *\Uniform Server\udrive\usr\local\php
ssleay32.dll to folder *\Uniform Server\udrive\usr\local\php

Enable extension:
Open php.ini located in folder *\Uniform Server\udrive\usr\local\php

Locate the line:
;extension=php_openssl.dll
Change to
extension=php_openssl.dll

Save and start the servers with luck your script should work.

Note: I believe PHP first looks in itís own folder to pick up the openssl files hence no need to place them in the system path!

Yahoo is not the only one that requires a secure connection the above may also be applicable to these.

I do not have this type of account hence thatís as far as I can test.

I hope the above is of some help.

All the best
Ric :)

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users