# [solved] problem with squirrelmail connecting to dovecot

## sumpi

Hi all!

I have a strange problem with squirrelmail and dovecot:

When I try to connect to dovecot on port 143 it gives 

 ERROR: Error connecting to IMAP server "localhost:143".Server error: (111) Connection refused

Trying to connect to dovecot manually using telnet works without problems.

The strange thing about is, that in my log file, I see no message, that dovecot has been contacted.

My config.php for squirrelmail is here:

```

<?php

global $version;

global $config_version;

$config_version = '1.4.0';

$org_name = "something.org";

$org_logo = SM_PATH . 'images/sm_logo.png';

$org_logo_width = '308';

$org_logo_height = '111';

$org_title = "something.org SquirrelMail $version";

$signout_page = '';

$frame_top = '_top';

$provider_name = 'foo.org';

$domain = 'bar.org';

$invert_time = false;

$useSendmail = false;

$smtpServerAddress = 'localhost';

$smtpPort = 25;

$encode_header_key = '';

$sendmail_path = '/usr/sbin/sendmail';

$sendmail_args = '-i -t';

$imapServerAddress = 'localhost';

$imapPort = 143;

$imap_server_type = 'other';

$use_imap_tls = false;

$use_smtp_tls = false;

$smtp_auth_mech = 'none';

$smtp_sitewide_user = '';

$smtp_sitewide_pass = '';

$imap_auth_mech = 'login';

$optional_delimiter = 'detect';

$pop_before_smtp = false;

$pop_before_smtp_host = '';

$default_folder_prefix = '';

$show_prefix_option = false;

$default_move_to_trash = true;

$default_move_to_sent  = true;

$default_save_as_draft = true;

$trash_folder = 'INBOX.Trash';

$sent_folder  = 'INBOX.Sent';

$draft_folder = 'INBOX.Drafts';

$auto_expunge = true;

$delete_folder = false;

$use_special_folder_color = true;

$auto_create_special = true;

$list_special_folders_first = true;

$default_sub_of_inbox = true;

$show_contain_subfolders_option = false;

$default_unseen_notify = 2;

$default_unseen_type   = 1;

$noselect_fix_enable = false;

$data_dir = SM_PATH . 'data/';

$attachment_dir = '/var/local/squirrelmail/attach/';

$dir_hash_level = 0;

$default_left_size = '150';

$force_username_lowercase = false;

$default_use_priority = true;

$hide_sm_attributions = false;

$default_use_mdn = true;

$edit_identity = true;

$edit_name = true;

$hide_auth_header = false;

$allow_thread_sort = false;

$allow_server_sort = false;

$allow_charset_search = true;

$uid_support              = true;

$session_name = 'SQMSESSID';

$config_location_base = '';

$theme_default = 0;

$theme_css = '';

$theme[0]['PATH'] = SM_PATH . 'themes/default_theme.php';

$theme[0]['NAME'] = 'Default';

$theme[1]['PATH'] = SM_PATH . 'themes/plain_blue_theme.php';

$theme[1]['NAME'] = 'Plain Blue';

...

$default_use_javascript_addr_book = false;

$abook_global_file = '';

$abook_global_file_writeable = false;

$abook_global_file_listing = true;

$abook_file_line_length = 2048;

$motd = "";

$addrbook_dsn = '';

$addrbook_table = 'address';

$prefs_dsn = '';

$prefs_table = 'userprefs';

$prefs_key_field = 'prefkey';

$prefs_user_field = 'user';

$prefs_val_field = 'prefval';

$addrbook_global_dsn = '';

$addrbook_global_table = 'global_abook';

$addrbook_global_writeable = false;

$addrbook_global_listing = false;

$squirrelmail_default_language = 'en_US';

$default_charset = 'iso-8859-1';

$lossy_encoding = false;

$no_list_for_subscribe = false;

$config_use_color = 2;

@include SM_PATH . 'config/config_local.php';

```

My dovecot.conf look like this:

```

# 2.2.6: /etc/dovecot/dovecot.conf

# OS: Linux 3.10.17-gentoo x86_64 Gentoo Base System release 2.2 

auth_debug = yes

auth_verbose = yes

disable_plaintext_auth = no

listen = *

mail_location = maildir:~/.maildir

passdb {

  args = /etc/passwd

  driver = passwd-file

}

passdb {

  args = *

  driver = pam

}

protocols = imap

service auth {

  user = root

}

ssl_cert = </etc/ssl/dovecot/server.crt

ssl_key = </etc/ssl/dovecot/server.key

ssl_parameters_regenerate = 0

userdb {

  args = /etc/passwd

  driver = passwd-file

}

verbose_ssl = yes

protocol lda {

  postmaster_address = postmaster@example.com

}
```

Can anybody point me to the right direction? 

Thanks for any advice in advance!

----------

## sumpi

After leaving the system for quite some time and get back to the problem yesterday, I managed to solve the issue!

It had nothing to do with squirrelmail oder dovecot!

Just for playing around, I changed the imap-server adr in squirrelmails config.php from localhost to 127.0.0.1. And it worked. So I was wondering, why this could be an issue and checked my /etc/hosts.

I had a line

```
 

127.0.0.1   localhost, testsystem, testsystem.domain.org 

```

( I just changed the names)

I could ping localhost, but I could not connect to any port on localhost.

I changed the line to this:

```
 

127.0.0.1   localhost

127.0.0.1   testsystem

127.0.0.1   testsystem.domain.org 

```

Now, even squirrelmail works with localhost again. 

Is this new? IIRC it was always possible to use more than one hostname in the same line...

Thanks anyways!

----------

## mimosinnet

 *sumpi wrote:*   

> 
> 
> ```
>  
> 
> ...

 

I think the "comma" is the probem. I have:

```
127.0.0.1   localhost mimo3o
```

Just in case somebody else reads this thread.

Cheers!

----------

