0

My code :

    require_once('C:\xampp\htdocs\jobs\protected\vendor\Mail-1.2.0\Mail.php');

    $from   = "s@gmail.com";
    $to         = "r@yahoo.com";
    $subject    = "Activation";
    $body   = "  Hi";

    $host   = "ssl://smtp.gmail.com";
    $username = "acc@gmail.com";
    $password = "password";
    $port   = "465";

    $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)) {
        $res['stat'] = false;
        $res['ket'] = $mail->getMessage();
    } else {
        $res['stat'] = true;
        $res['ket'] = true;
    }
    print_r($res);

It need enabling php_openssl.dll

is there any some way without activated it in php.ini?

or maybe activated by code in php..?

*when i'm activated php_openssl.dll in php.ini it's work's, and i don't want to activated it directly and then restart the service..

Budi Mulyo
  • 384
  • 5
  • 22
  • i was use dl() but it depreciated.. if (!extension_loaded('php_openssl')) { dl('php_openssl.dll'); } – Budi Mulyo May 03 '15 at 14:59
  • Pear::mail hasn't been updated in five years. Use [PHPmailer](http://PHPmailer.worxware.com) instead. –  May 03 '15 at 15:00
  • That's not something that can be implemented in PHP code. Use the `php.ini` to set up the library. Or since this is just a local installation, download a newer WAMP or whatever package. – mario May 03 '15 at 15:00
  • @HoboSapiens : i use PEAR's Mail version 4 and 5 i think it's fine.. it's works if i activated openssl – Budi Mulyo May 03 '15 at 15:03
  • @mario :yeah i use it locally but when in production it can't used if we can't change php.ini in some case, so it's didn't good enough i think.. – Budi Mulyo May 03 '15 at 15:05
  • @mario : the question is not about enabling it, but any another way to activated it, without directly edit it... to enable it just add "extension=php_openssl.dll" in php.ini and restart local server.. – Budi Mulyo May 03 '15 at 15:07
  • There is **no** other way to enable it. – mario May 03 '15 at 15:14
  • @mario but why it's marked as duplicated? i'm really hope if someone know it,, at least i was try and ask.. – Budi Mulyo May 03 '15 at 15:18
  • There's no point in leaving this question open. The only answer you could garner here is "No, not possible. End of story". Nobody is going to implement a PHP userland SSL library for you. – mario May 03 '15 at 15:21

0 Answers0