Apple webmail on Lion (10.7) Server is returning a popup error message about 60 seconds after trying to login:

Connection to imap server failed

or in Dutch:

Connectie met IMAP server mislukt


  • Using the same user name and password, while sending and receiving mail works from Mail.app.

This Lion Server:

  • runs 10.7.5
  • is located behind a NAT router device
  • id configured on a non routable IP address
  • uses a "Computer Name" and "Host Name" that are identical
  • has a "Computer Name" and "Host Name" that are in the form of "host.domain.tld"
  • "host.domain.tld" has an A record in public DNS that refers to the public IP address of the NAT router

How to fix this 'Connection to IMAP server failed' issue?

1 Answer 1


The Apple Webmail "Connection to IMAP server failed" error kept re-appearing, I changed /usr/share/webmail/config/appleoverrides.inc.php to:

$rcmail_config['default_host'] = 'localhost';
//$rcmail_config['smtp_server'] = '%h';

Idea from

Change in /usr/share/webmail/config/appleoverrides.inc.php the value of rcmail_config['default_host'] from its default 'tls://%h' to 'tls://macserver.examle.com'.

source: https://discussions.apple.com/message/16922962

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .