php - ZF2 send mail always get error [Could not open socket] -


i using zend mail send out email zimbra.

        $message = new \zend\mail\message();         $message->setbody("test");         $message->setfrom("febri.damatraseta@mydomainzimbra.com");         $message->setsubject("trying send email");         $message->addto("febryfairuz@gmail.com");          $smtpoptions = new \zend\mail\transport\smtpoptions();         $smtpoptions->sethost("192.123.456.789:01")                     ->setconnectionclass('login')                     ->setname('192.123.456.789:01')                     ->setconnectionconfig(array(                         'username'  => 'febri.damatraseta@mydomainzimbra.com',                         'password'  => '123abc',                         'ssl'       => 'tls'                     ));         $transport = new \zend\mail\transport\smtp($smtpoptions);         $transport->send($message); 

i receive error:

could not open socket

and have openssl installed. can me?

i fall same issue few weeks ago, correct usage:

// setup smtp transport using login authentication         $transport = new smtptransport ();         $options = new smtpoptions ( array (                 'name' => 'whatever.com',                 'host' => 'smtp',                 'connection_class' => 'plain',                 'port' => '587', // notice port change tls 587                 'connection_config' => array (                         'username' => '',                         'password' => '',                         'ssl' => 'tls'                  )          ) );         $transport->setoptions ( $options );         $transport->send ( $message ); 

Comments