0

I have installed a siwapp invoicing software. It installed successfully but when I tried to use a recurring profile or even sending an invoice to my clients, it came to an error says :

Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:25 (Connection refused) in /home/olepress/public_html/my/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php on line 233

Warning: Cannot modify header information - headers already sent by (output started at /home/olepress/public_html/my/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php:233) in /home/olepress/public_html/my/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 336

Warning: Cannot modify header information - headers already sent by (output started at /home/olepress/public_html/my/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php:233) in /home/olepress/public_html/my/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 357

Warning: Cannot modify header information - headers already sent by (output started at /home/olepress/public_html/my/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php:233) in /home/olepress/public_html/my/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 357

I tried to search it, theres a lot of issues similar to my problem but I am not quite sure if we are using the same softare. Tried to play arround the souce files of this software and I found this configuration file contains:

test:
  storage:
    class: sfSessionTestStorage
    param:
      session_path: %SF_TEST_CACHE_DIR%/sessions

  response:
    class: sfWebResponse
    param:
      send_http_headers: false

  mailer:
    param:
      delivery_strategy: none

all:
  routing:
    class: sfPatternRouting
    param:
      generate_shortest_url:            true
      extra_parameters_as_query_string: true
  user:
    class: SiwappUser
    param:
      timeout:         1800
      logging:         %SF_LOGGING_ENABLED%
      use_flash:       true
      default_culture: %SF_DEFAULT_CULTURE%

#all:
#  controller:
#    class: sfFrontWebController
#
#  request:
#    class: sfWebRequest
#    param:
#      logging:           %SF_LOGGING_ENABLED%
#      path_info_array:   SERVER
#      path_info_key:     PATH_INFO
#      relative_url_root: ~
#      formats:
#        txt:  text/plain
#        js:   [application/javascript, application/x-javascript, text/javascript]
#        css:  text/css
#        json: [application/json, application/x-json]
#        xml:  [text/xml, application/xml, application/x-xml]
#        rdf:  application/rdf+xml
#        atom: application/atom+xml
#
#  response:
#    class: sfWebResponse
#    param:
#      logging:           %SF_LOGGING_ENABLED%
#      charset:           %SF_CHARSET%
#      send_http_headers: true
#
#  user:
#    class: myUser
#    param:
#      timeout:         1800
#      logging:         %SF_LOGGING_ENABLED%
#      use_flash:       true
#      default_culture: %SF_DEFAULT_CULTURE%
#
#  storage:
#    class: sfSessionStorage
#    param:
#      session_name: symfony
#
#  view_cache:
#    class: sfFileCache
#    param:
#      automatic_cleaning_factor: 0
#      cache_dir:                 %SF_TEMPLATE_CACHE_DIR%
#      lifetime:                  86400
#      prefix:                    %SF_APP_DIR%/template
#
#  i18n:
#    class: sfI18N
#    param:
#      source:               XLIFF
#      debug:                false
#      untranslated_prefix:  "[T]"
#      untranslated_suffix:  "[/T]"
#      cache:
#        class: sfFileCache
#        param:
#          automatic_cleaning_factor: 0
#          cache_dir:                 %SF_I18N_CACHE_DIR%
#          lifetime:                  31556926
#          prefix:                    %SF_APP_DIR%/i18n
#
#  routing:
#    class: sfPatternRouting
#    param:
#      load_configuration:               true
#      suffix:                           ''
#      default_module:                   default
#      default_action:                   index
#      debug:                            %SF_DEBUG%
#      logging:                          %SF_LOGGING_ENABLED%
#      generate_shortest_url:            false
#      extra_parameters_as_query_string: false
#      cache:
#        class: sfFileCache
#        param:
#          automatic_cleaning_factor: 0
#          cache_dir:                 %SF_CONFIG_CACHE_DIR%/routing
#          lifetime:                  31556926
#          prefix:                    %SF_APP_DIR%/routing
#
#  logger:
#    class: sfAggregateLogger
#    param:
#      level: debug
#      loggers:
#        sf_web_debug:
#          class: sfWebDebugLogger
#          param:
#            level: debug
#            condition:       %SF_WEB_DEBUG%
#            xdebug_logging:  true
#            web_debug_class: sfWebDebug
#        sf_file_debug:
#          class: sfFileLogger
#          param:
#            level: debug
#            file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log

Did I miss something here? How can I fix this?

leojarina
  • 157
  • 4
  • 15
  • 1
    `unable to connect to localhost:25 (Connection refused)` means you have no mail server running on the local host or it isn't listening on port 25 (perhaps 465 or 587). Do you know how you want to send mail (sendmail, a local smtp server, or a remote one)? – drew010 Jul 28 '12 at 05:14
  • Im sorry I am new on this issue and I don't understand the process. – leojarina Jul 28 '12 at 05:22

3 Answers3

0

Check the configuration of that application: you have to configure which mail server to use (smtp server). Give it the address of that server that sends your mail when using other software.

arkascha
  • 41,620
  • 7
  • 58
  • 90
  • I have already change the configuration into correct login information, hosts and port but the problem still there – leojarina Jul 28 '12 at 05:34
  • Well, if you specified another smtp server and it still tries to connect to localhost:25 then you know where to look: your configurations seems to be ignored. Without you giving those configurations you refer to, no one here can comment on it, I am afraid. – arkascha Jul 28 '12 at 05:54
0

If you are on linux, try installing sendmail on the server, (debian/ubuntu sudo apt-get install sendmail, (rhat/centos yum install sendmail).

If you have credentials for an external SMTP server like Gmail, or your ISP, you should be able to specify the host details and credentials in the config file you found, refer to the documentation for sending mail in siwapp.

You can use SMTP with a configuration similar to:

prod:
  ...
  mailer:
    param:
      delivery_strategy: realtime
      transport:
        param:
          host: smtp.gmail.com
          port: 465
          encryption: ssl
          username: your_gmail_username@gmail.com
          password: your_gmail_password

To use PHP sendmail, use a configuration like this:

prod:
...
  mailer:
    param:
      delivery_strategy: realtime
      transport:
        class: Swift_MailTransport

The config file to edit is siwapp/config/factories.yml

Hope that helps.

drew010
  • 68,777
  • 11
  • 134
  • 162
  • I am on a shared hosting, is it still possible to fix this problem? – leojarina Jul 28 '12 at 05:49
  • If you have shared hosting then you should be able to send mail. See the edited answer and try just using sendmail instead. You can still use SMTP if you want. – drew010 Jul 28 '12 at 05:54
  • I have siwapp/config/factories.yml configuration above, Im not quite sure where to put your edited code. Please advise – leojarina Jul 28 '12 at 07:49
  • Right towards the beginning of what you posted is the `mailer` section that says `delivery_strategy: none` so you can just replace that part with one of the above configs, probably try the realtime Swift_MailTransport one first. – drew010 Jul 28 '12 at 18:45
0

I know this thread is old, but I have finally found the solution to this very aggravating error.

The install notes for siwapp are a bit... bitty and a whole picture is hard to come by. I've compiled these notes in the mean time

Copy the factories.yml file to your config folder

cp <siwapp_root>/apps/siwapp/config/factories.yml <siwapp_root>/config/factories.yml

Modify your prod section thus

prod:
  ...

  mailer:
    param:
      delivery_strategy: realtime
      transport:
        param:
          host: smtp.gmail.com
          port: 465
          encryption: ssl
          username: your_email_address@gmail.com
          password: your_password

Replacing the values for address and password.

Empty the cache at /cache/* (but do not remove the directory itself!) to remove the old configurations. I've had trouble with this before though, so you would be best advised to make a backup of the cache directory...

tar -czf siwappcachebkp.tgz <siwapp_root>/cache/*

To manually configure email if rebuilding the cache fails for some reason, you need to modify specifically this file:

<siwapp_root>/cache/siwapp/prod/config/config_factories.yml.php

At the end of the file, you will find the mail connectivity details hardcoded to map; enter the correct values and you'll be good to go.

taifwa
  • 302
  • 2
  • 10