Using Squirrelmail With Ubuntu
Your home pc or home server running Ubuntu can easily be used to send email and run many web server applications such as phpMyAdmin and Squirrelmail. This tutorial will explain how to install and use Squirrelmail with Ubuntu.
1) root# apt-get install squirrelmail squirrelmail-locales Type 'Y' 2) root# squirrelmail-configure ^C 3) root# ln -s /etc/squirrelmail/apache.conf /etc/apache2/conf.d/squirrelmail.conf Restart apache root# /etc/init.d/apache2 restart 4) Check browser to see if login shows up: http://localhost/squirrelmail/src/login.php 5) Open browser and run configtest to troubleshoot. Often, some things need to be changed. http://localhost/squirrelmail/src/configtest.php You may see errors and warnings such as; 'ERROR: Error connecting to IMAP server "localhost:143".Server error: (111) Connection refused' root# apt-get install nmap root# nmap localhost root# sudo iptables -A INPUT -p tcp --dport (143) -j ACCEPT root# iptables-save root# sudo apt-get install dovecot-postfix Run this again: http://localhost/squirrelmail/src/configtest.php You should see: Congratulations, your SquirrelMail setup looks fine to me! Try logging in: If unsuccessful, you will need to change owners and permissions root# chown daemon:daemon data root:/var/lib/squirrelmail# chmod -R 777 data root:/var/lib/squirrelmail# mkdir attachments root:/var/lib/squirrelmail# chmod -R 777 attachments root:/var/lib/squirrelmail# chown daemon:daemon attachments
Now, you need to have a non-root user that can login.
root# useradd myusername root# passwd add_password_here
At this point, you can attempt a login. If anything fails, you can find the errors in the /var/log/mail.log file. One possible error could be that the user does not have the mail directory setup in the proper location. What the error below is attempts to explain is that it cannot create mail directory. The reason for that is because the there is no /home/myusername. Under some Linux conditions and distros, the folder is created automatically. In this case, it was not.
Jul 23 11:09:59 NAME-VirtualBox dovecot: imap-login: Login: user=<myusername>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=8117, secured Jul 23 11:09:59 NAME-VirtualBox dovecot: imap(myusername): Error: user myusername: Initialization failed: Initializing mail storage from mail_location setting failed: mkdir(/home/myusername/Maildir) failed: Permission denied (euid=1001(myusername) egid=1001(myusername) missing +w perm: /home, dir owned by 0:0 mode=0755) Jul 23 11:09:59 NAME-VirtualBox dovecot: imap(myusername): Error: Invalid user settings. Refer to server log for more information.
The code below shows how to setup the mail directory for a new user.The first step is to create the folder for the user and the second step is to create the folder for the email directory. After that, the permissions are set for that user.
root@NAME-VirtualBox:/home# mkdir myusername root@NAME-VirtualBox:/home# cd myusername root@NAME-VirtualBox:/home/myusername# mkdir Maildir root@NAME-VirtualBox:/home# chown -R myusername:myusername myusername
At this point, you will like want to send email that is authenticated. In order to do this, you need to have the DNS for your domain name point to the IP at home. To make sure email is sent through a valid email address, add this line to the bottom of main.cf file.
smtp_generic_maps = hash:/etc/postfix/generic
After that, open and create the file /etc/postfix generic and add this line.
Now, you just need to reload the postfix service and you can send email. To receive email, you need to enable port forwarding on the router so that the local network ip of your machine or Virtual machine is forwarded through port 25.