php - Swift mailer connection refused with symfony1.2 -


im having problems sending mail. have ubuntu server running postfix mailserver. webapp based on symfony 1.2 , has swift 3 mailing. everyrhing running on same server. code im trying run:

public static function sendmaillocal($mailfrom, $mailto, $subject, $mailbody, $preverror) {   $mailer = null;  try   {     $connection  = new swift_connection_smtp('localhost', '25');      $mailer = new swift($connection);     // create mailer , message objects   $message = new swift_message($subject, $mailbody, 'text/html');      // send     $mailer->send($message, $mailto, $mailfrom);     $mailer->disconnect();   } catch (exception $e)   {     if($mailer != null)       $mailer->disconnect();     throw new emailtransferexception ("there error while trying send email - locally:" . $e->getmessage() . " , first error:" . $preverror);   }  } 

this error message im getting:

there error while trying send email - locally:the smtp connection failed start [localhost:25]: fsockopen returned error number 111 , error string 'connection refused' ,

it's kind of strange, because did manage send mail without swift code:

//adresses examples $to = "john.doe@mail.com"; $sender_email = "someone@mail.com"; // send html mail, content-type header must set $headers  = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n"; // additional headers $headers .= 'to: <'.$to.'>' . "\r\n"; $headers .= 'from: john doe<'.$sender_email.'>' . "\r\n"; // mail $success = mail($to, "test server", "msg", $headers); 

anybody got ideas this??

thanks!

it's not problem symfony or php - local smtp server unreachable. have configuration problem mail server preventing smtp server being available on it's native port (25).


Comments

Popular posts from this blog

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

jQuery clickable div with working mailto link inside -