php - Send a mail with Zend Framework : "Connection could not be established" -


i'm working on "old" php/zend project right now. installed locally, fine except part app sends confirmation mail after user has completed form.

the error have "connection not established"

this code :

public function sendmail($user, $gain=null) { global $config;

$this->_view->url   = $config->app->url;  $tr = new zend_mail_transport_smtp($config->app->mail->server); zend_mail::setdefaulttransport($tr);  $mail = new mgmail($config->app->mail->key, true); $mail->setfrom($config->app->mail->from, $config->app->mail->fromname);  if ($gain == null) {     $object = $config->app->mail->object->inscription;     $render = $this->_view->render('inscription.phtml'); } else {     switch ($gain)     {         case 'peignoir':             $gain_name = 'un '.$gain;         case 'casquette':             $gain_name = 'une '.$gain;     }      $object = sprintf($config->app->mail->object->gain, $gain_name);     $render = $this->_view->render($gain.'.phtml'); }  $mail->setsubject($object); $mail->addto($user->email, $user->first_name.' '.$user->last_name); $mail->setbodytext($render);  $mail->send();  $this->savesendemail($object, $render, $user); 

}

$config->app->mail->server 

contains "localhost"in application.ini

what need fix problem ? there php modules activate? sorry if it's obvious you, have not been working on long time...

ensure running smtp service locally on machine working on. can check using telnet localhost on port 25:

telnet localhost 25

if times out, not have smtp server installed or running:

c:\users\username>telnet localhost 25 connecting localhost...could not open connection host, on port 25: connect failed

that problem.

to resolve it, need install , configure mailserver. have used hmailserver (www.hmailserver.com) in past , worked fine.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -