Here’s a quick guide to enabling the CAPTCHA plugin in Squirrelmail.
- Download and unzip/untar the following two Squirrelmail plugins to your plugins directory:
a) User Information
b) CAPTCHA
- Enable the User Information plugin by running the Squirrelmail configuration script. Run ./configure, select 8 for plugins, typeg the number corresponding to the user_info plugin, and save.
- Obtain a free public/private RECAPTCHA key to use on your site. http://www.google.com/recaptcha.
- Copy the default configuration file inside plugins/captcha.
cp config_example.php config.php
- Edit the config.php and setup the $captcha_backend variable
$captcha_backend = 'recaptcha';
- If you don’t want the CAPTCHA to appear on your local IP(s), you can define them in the $hide_captcha_ips variable.
$hide_captcha_ips = array('MY IP ADDRESS');
- Go to the plugins/captcha/backends folder and copy the recaptcha_config_example.php as recaptcha_config.php.
cp recaptcha_config_example.php recaptcha_config.php
- Edit recaptcha_config.php and enter your RECAPTCHA private and public keys. They should be listed in the welcome e-mail from RECAPTCHA.
$recaptcha_public_key = 'YOUR PUBLIC KEY';
$recaptcha_private_key = 'YOUR PRIVATE KEY'; - The last step is to enable to CAPTCHA plugin in Squirrelmail. Run the Squirrelmail configuration script. Run ./configure, select 8 for plugins, type the number corresponding to the captcha plugin, and save.
Notes: I noticed there is a bug inside the CAPTCHA plugin if you don’t have the user_information plugin installed. Its not a big deal, so I just added the user_information plugin to the installation instructions. Line 183 has missing parentheses for the file_exists case.
It should look like the following:
if ((!empty($hide_captcha_ips) || !empty($show_captcha_ips))
&& file_exists(SM_PATH . 'plugins/user_info/functions.php'))