Before using SquirrelMail, the user should first fill in at least the name and email address in the Personal Information option. But we can eliminate this step by using the RetrieveUserData plugin to retrieve this information from a variety of sources and automatically update this information.
Install the RetrieveUserData Plugin

1. Download the retrieveuserdata plugin.
5. Click the notepad button and in the Location field type in /usr/share/squirrelmail/plugins/ and click Open.
The RetrieveUserData archive has to be extracted directly into the SquirrelMail plugin directory to enable Linux to apply the proper SELinux Context into the files.Configure the RetrieveUserData Plugin
Make sure you have configured the domain in SquirrelMail.
1. From a Terminal window, type in /usr/share/squirrelmail/config/conf.pl and press Enter. This will launch the SquirrelMail Configuration utility.
If your Terminal window has a white background, make sure that the colors are off by looking for the command Turn color on. If the command is Turn color off, type in C and press Enter to turn the colors off. This will ensure that you will be able to read all of the text.

4. Return to the Main Menu by typing in 9 and press Enter. Go to the General Options by typing in 4 and press Enter. In the General Options, type in 9 and press Enter to configure the editing of identity. This option will allow you to disable editing of the name and email address since this will be automatically updated. Save your changes when you are done.

5. Login to SquirrelMail and go to the Options page and click Personal Information. The Full Name and E-mail Address should have been automatically filled up.
By default, RetrieveUserData will retrieve the name and email address from the Linux system accounts, but you can configure this by editing the file /usr/share/squirrelmail/plugins/retrieveuserdata/config.php.
If you will be retrieving user information from an Active Directory or LDAP server, it will be easier if you setup the LDAP addressbook first so that the plugin can use the LDAP connection details there. Then all you have to do is comment the line $SQRUD_RETRIEVE_DATA_FROM = "passwd.php" and uncomment the line $SQRUD_RETRIEVE_DATA_FROM = "ldap.php" in the configuration file.Visit the forum to ask for help or to give a comment.
***
Posted on 12/24/2007 and last updated on 11/30/2009
Filed under Active Directory , LDAP , SquirrelMail






January 15th, 2008 at 1:56 pm
I am connecting to Windows ServerAD using LDAP.But if I send a test mail from Linux Box, It is not forwarding to Exchange Server. It is storing in Linux Box (that is Vmail/user id). Kindly provide the solution.
Regards,
Muthu
January 16th, 2008 at 1:44 pm
Hi,
That is the intended result. Sending a mail should be processed in the Linux box. I think what you want to do is use the Linux mail server as an anti-spam/anti-virus firewall/gateway/relay for Exchange. Sorry, I don’t have a step by step guide for that, but this should help Postfix email firewall/gateway. Or, use a Linux network appliance specifically for that job, like the Barracuda Spam Firewall. This would make the implementation so much easier.
January 20th, 2009 at 9:44 am
Hi there,
We using SquirrelMail with hMailServer. We looking for SquirrelMail auto address complete linking to Active Directory.
Any ideas?
Thank you.
January 20th, 2009 at 10:17 am
Hi Wings,
I don’t understand what you need. If you want to automatically retrieve the name and email address, the steps above works with Active Directory. If you want something else, check out Active Directory in Linux.
January 20th, 2009 at 11:17 am
Hi there,
Thanks. Let me try it out first. If cannot then only I post again.
Thank you.
April 10th, 2009 at 5:25 am
Hi All,
The email thats displayed on the email field is marvin@ only.
What can I do to make the domain to show on my email add that should look like this marvin@mydomain.com?
Thanks in advance.
Regards,
Marvin
June 2nd, 2009 at 7:37 pm
I ran into the same problem as Marvin reported above. The domain didn’t show up in the e-mail address. It turns out it’s an SELinux problem, as the default policy doesn’t allow running the “hostname” command from httpd, and therefore PHP scripts can’t use it. There are two solutions I can think of:
1) edit plugins/retrieveuserdata/passwd.php to explictly set the $domain_name variable to your own domain name, rather than relying on the “hostname” command to retrieve it, or
2) add a policy module to allow hostname to run from PHP scripts. Here is my squirrelmail.te file:
—————————————–
module squirrelmail 1.0;
require {
type httpd_t;
type hostname_exec_t;
class file { read getattr execute execute_no_trans };
}
#============= httpd_t ==============
allow httpd_t hostname_exec_t:file { read getattr execute execute_no_trans };
—————————————–
which is loaded using these commands:
checkmodule -M -m -o squirrelmail.mod squirrelmail.te
semodule_package -o squirrelmail.pp -m squirrelmail.mod
semodule -i squirrelmail.pp
I hope this doesn’t get mangled by line wrapping.
June 6th, 2009 at 6:14 pm
didn’t work for me until i modified the “ldap.php” file. to make it work, right after setting the protocol version and before binding to the server, i added:
// needed for Windows 2003 Active Directory
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
June 6th, 2009 at 8:58 pm
Hi Gabriel,
Your Linux server is probably not using an Active Directory enabled DNS because Active Directory returns some funky referrals that only an AD enabled DNS can handle.
June 7th, 2009 at 3:27 pm
the PDC (win2003) is the master DNS for the zone, while the linux server (CentOS 5.3) is the slave DNS. i’ve also defined two A records (in the master zone on the PDC) with the same name for the AD LDAP, one with the IP of the PDC and the other with de IP od the BDC … a kind of failover for ldap searches. now i’ve still to work out issues with the address book returning different results, depending on the queried DC (DNS returns the IP for the ldap server using round robin).
June 9th, 2009 at 1:59 pm
Hi Gabriel,
That’s probably the cause of problem. Microsoft added a few proprietary functionality into their DNS which is not available in the Linux slave DNS. Anyway, I’ve updated the plugin to support disabling of referral chasing.
June 9th, 2009 at 2:04 pm
Hi Gilles Detillieux,
Thank you very much for your input. I’ve removed the hostname function call in the plugin and used the domain specified in the SquirrelMail configuration instead. I’ve also updated my articles to be more SELinux friendly.
June 13th, 2009 at 10:09 pm
Hello,
I have managed to work through the previous tutorials on fedora and all working perfect till now. I am unable to login througth:
http://localhost/webmail/src/webmail.php
I keep getting this in the log file:
[client 127.0.0.1] PHP Fatal error: Call to undefined function posix_getpwnam() in /usr/share/squirrelmail/plugins/retrieveuserdata/passwd.php on line 20, referer: http://localhost/webmail/src/login.php
Do you know how to solve it?
Thanks.
June 13th, 2009 at 11:13 pm
Hi,
I managed to solve this one, thank you.
July 22nd, 2009 at 9:44 pm
Hi,
The above solution is working, but i am not able to getting correct e-mail address from my AD server. I am getting account name of AD account and domain name.
for example :
AD mail address : mail1@test.com
User Account : test1
I am getting test1@test.com in my personal info.
Please suggest how to retrieve mail address from AD server.
Thanks.
SK
July 25th, 2009 at 9:33 pm
Hi Surendra,
Make sure you are using ldap.php and not passwd.php in your config.php
$SQRUD_RETRIEVE_DATA_FROM = “ldap.php”
August 17th, 2009 at 10:01 pm
Hey Tweety20,
How did you solved the error?
Thank you,
Alin
August 20th, 2009 at 7:29 am
Hi Alin Ilie,
The PHP Posix functions are included in RHEL/CentOS. My guess is that Tweety20 is using a different distribution which requires a separate installation of the PHP Posix package.
August 20th, 2009 at 1:23 pm
Hi consultant,
In Fedora 11 the Posix functions are included in php-process-*.rpm
Thank you,
Alin