imapsync: Can not open imap connection: Connection refused

Discussion in 'HOWTO-Related Questions' started by mroppolo, Jul 15, 2012.

  1. mroppolo

    mroppolo New Member

    Hi all -

    I've just set up a new Debian "Squeeze" server and discovered imapsync was no longer part of the distribution. Fortunately, I kept a copy of the old package and installed it, including the related support packages.

    When I issue the imapsync command:
    imapsync \
    --host1 <SourceServer> --user1 <EmailUser> --password1 <Password> --port1 163 --authmech1 LOGIN \
    --host2 <DestServer> --user2 <EmailUser> --password2 <Password> --port2 164​

    I receive the error:
    Can not open imap connection on <DestServer> with user <EmailUser> : IO::Socket::INET: connect: Connection refused​

    I used the following instructions from "The Perfect Server - Debian Squeeze (Debian 6.0) With BIND & Dovecot [ISPConfig 3]"

    I double checked my router ports and they seem fine. ifconfig on the <DestServer> displays the correct IP address, but I cannot Telnet to it using port 164 (hence the connection refused error).

    Can anyone help me resolve this ?

    Thanks !
  2. TiTex

    TiTex Member

    is your imap server actually runing on --port2 164 ?
    or you redirected from your router external 164 to internal 143 ?
    are your sure that the server isn't firewalled on the imap port ?
  3. mroppolo

    mroppolo New Member

    I'm really running imapsync on ports 143 and 144. I just changed the numbers in the thread to obfuscate. :)

    1) I don't know how to verify on which port imap is running. I assumed it was port 143
    2) I'm certain I'm not redirecting via the router
    3) I don't know how to check if there's a a firewall blockage

    If you could provide me with details, I will take a look and report back.

    Thanks !
  4. TiTex

    TiTex Member

    the easyest way to check if you establish the connection is with telnet
    like if you're runing imapsync on the server where you will copy the mailbox
    telnet 143
    if this gives you connection refused or time out then you should check on that server from a terminal if imap is actually running ,
    netstat -tnlp | grep 143
    telnet localhost 143
    if this works then check your firewall
    iptables -nL
    and 3rd check you router if your port's are configured as it should
    external ip port -> internal server's ip imap port
    Last edited: Jul 16, 2012
  5. mroppolo

    mroppolo New Member

    Thanks for the instructions ! I'm at work now, but will give it a try and provide an update later tonight.
  6. mroppolo

    mroppolo New Member

    It's Face-Palm time !

    I discovered the error of my ways.

    imap is running on the same port on both servers. I apparently mis-typed the command when I made my installation notes the last time I did this. :rolleyes:

    Thanks for taking the time to help me.

Share This Page