The solution to the error “ImportError: No module named ldap”

Installed iRedMail on Ubuntu Server in February 2016 and noticed an error when trying to send a message via Roundcube:

SMTP error (451): Unable to add recipient “Email” (4.3.5 Server configuration problem)

I checked if iredapd is running:

telnet localhost 7777

It turned out that it was not running because the response from telnet was displayed:

Unable to connect to remote host: Connection refused

Tried to run:

sudo /etc/init.d/iredapd start

To which he received the answer:

ImportError: No module named ldap

I installed the module with the command:

sudo apt-get install python-ldap

A little chemistry:

sudo -i
cd /opt/iredapd/
find . -name '*pyc' | xargs rm -f {}

Now restart the service:

sudo service iredapd restart

Done, there is no error.

Leave a Reply