Gmail IMAP lets you download messages from Gmail’s servers onto your computer so you can access your mail with a program like Microsoft Outlook Express or Apple Mail, even when you aren’t connected to the Internet.
This article will provide instructions for setting-up Gmail with SquirrelMail.
There may be some scenarios when we do not want to use the regular Gmail interface. If your domains is configured to use “Google Apps” for email service then you can easily setup SquirrelMail for seamless integration with you portal. It can also be used if regular Gmail (http://mail.google.com) is blocked by your firewall administrator ![]()
Installation Steps:
1. Confirm that IMAP is enabled (see details here)
2. Create a place holder for SquirrelMail and unpack the latest distribution
mkdir -p /home/squirrel/data/attachments cd /home/squirrel/ chown -R apache.apache data tar zxvf ~/downloads/squirrelmail-1.4.13.tar.gz
3. Configure the installation (do nothing simply save and quit).
cd squirrelmail-1.4.13 ./configure
If you do not have SSH access then copying “config/config_default.php” as “config/config.php” will also work (thanks Martin).
4. Append following lines into /home/squirrel/squirrelmail-1.4.13/config/config_local.php
$domain = 'gmail.com'; // IMAP settings $imapServerAddress = 'imap.gmail.com'; $imapPort = 993; $use_imap_tls = true; $imap_auth_mech = 'login'; // SMTP settings $smtpServerAddress = 'smtp.gmail.com'; $smtpPort = 465; $use_smtp_tls = true; $smtp_auth_mech = 'login'; // Special folder setting $trash_folder = '[Gmail]/Trash'; $sent_folder = '[Gmail]/Sent Mail'; $draft_folder = '[Gmail]/Drafts'; // Attachment $data_dir = '/home/squirrel/data/'; $attachment_dir = '/home/squirrel/data/attachments/'; // Optional - $provider_name = 'Gmail alternative by Sudhaker'; $provider_uri = 'http://sudhaker.com/';
5. Create an alias in apache /etc/httpd/conf.d/squirrel.conf
Alias /sq "/home/squirrel/squirrelmail-1.4.13" <Directory "/home/squirrel/squirrelmail-1.4.13"> AllowOverride AuthConfig Order allow,deny Allow from all </Directory>
6. Verify the setup by browsing to ${site_url}/sq/
User Id: example@gmail.com (or user@example.com)
Password: email_password
Run this command as “root” if SELinux is enabled.
setsebool httpd_can_network_connect trueHow can I verify if SELinux is enabled?
This is a typical response on non-SELinux system. Try it on your’s and you’ll know it.
id -Z
Make appropriate changes for cPanel based hosting (very popular shared hosting platform).
Please drop a comment if you find it useful.
Cheers,
Sudhaker
Responses to “Gmail IMAP with SquirrelMail”
March 27th, 2008 at 1:03 pm
Did you check my last comment about SELinux? I usually disable SELinux on my boxes as it is more pain than help.
I assume that you are trying it on your home linux. If so try followings
@ Desktop > System Settings > Security Level > SELinux > httpd > HTTPD
Scripts to connect to the network [allow it]
or if you prefer command line then try following
setsebool httpd_can_network_connect trueHope this help.
Thanks,
April 9th, 2008 at 10:44 am
I followed the directions given above on a Mac. I was able to get to the login page. However, when I attempt to log in with my gmail username and password, it processes for a while and then Squirrel gives me an error. It says that it the IMAP connection has been dropped. Any ideas?
April 9th, 2008 at 10:58 am
Never owned a MAC so can’t help you much.
But I assume that MAC is Unix with nice UI and problem is because of SELinux / firewall settings.
Try these things and let me know if you see anything relevant :-
tail /var/log/messages tail /var/log/httpd/error.log
Try
getsebool -aand watch for httpd_can_network_connect
Hope this helps.
April 9th, 2008 at 11:09 am
This is on a Mac that does not use SELinux. The error I get also makes it sound like Squirrel was able to make the network connection, but it is being dropped.
I have squirrel working with a local IMAP client, so I don’t believe it is the same error as others were having.
September 2nd, 2008 at 7:06 am
if you have just a ftp access, you cannot do
$ ./configure.
in this case,
$ mv config/config_default.php config/config.php
does the job!
November 4th, 2008 at 9:58 am
I managed to configure squirrelmail 1.4.16 on fedora 9 using these settings, although I made the edits using the config/conf.pl utility.
March 27th, 2008 at 6:41 am
Hey Sudhaker,
tx for the tutorial but I was unsuccessful so far.
SquirrelMail version 1.4.13
I keep getting:
Error connecting to IMAP server: tls://imap.gmail.com.
13 : Permission denied
Now, I suspect that gmail is expecting ssl instead of tls protocol; but than, tls works for you…
Any ideas? I checked my credentials million times and I can get in using thunderbird.