MacOS – How to fix Lion 10.7 Apple Webmail “Connection to IMAP server failed”

macosNetworkserver.app

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

Regression:

  • 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 192.168.0.1 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?

Best Answer

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