Jake Vickers wrote:
PakOgah wrote:
I dont know if this still an issue for those using qmt to provide
squirrelmail global address book but I just found out on this link, it
very easy to provide global address book
http://www.squirrelmail.org/docs/admin/admin-7.html#ss7.5

just run sqweb config utility, go to menu Addressbook and choose menu
Global Address book and enter the path of globaladdressbook file reside

then you create the globaladdressbook file
with the following order
nickname|firstname|lastname|[EMAIL PROTECTED]|info

Nice. I'll try and add this to the next version of QTP.

actually Jake, I get those lists from scripts I made
I know it's may not perfect but the result is just what I need
these scripts need more enhancement
- use 2 script to create one global address book, if it were only 1 script it would be simpler
- these scripts only can generate one global address book for one domain
- and thus 1 global address book is configured with your Squirrelmail
  so if your webmail support multidomain, the global address book didn't
- can't update dynamicly if there are changes in email account and/or milist
  you have run it again via cron (weekly/daily)
- user which his email address listed can't update his info
(I am setup my squirrelmail with policy no one can change global address book)

<?php
/*
# squirrelmail global address book updater
# [EMAIL PROTECTED]
# ver 0.1 (2 Aug 2007)
# - initial script
# ver 0.3 (3 Aug 2007)
# - add full path and test if php script exist
# - add detail documentation
#
# need more enhancements
# - use 2 script to create one global address book, if it were only 1 script it 
would be simpler
# - these scripts only can generate one global address book for one domain
# - and thus 1 global address book is configured with your Squirrelmail
#   so if your webmail support multidomain, the global address book didn't
# - can't update dynamicly if there are changes in email account and/or milist
#   you have run it again via cron (weekly/daily)
# - user which his email address listed can't update his info
#   (I am setup my squirrelmail with policy no one can change global address 
book)
*/
// configuration 
// your domain name
$domainname="pala.bo-tak.info";
// your domain table name inside vpopmail database
$tablename="pala_bo_tak_info";
$username="vpopmail";
$password="SsEeCcRrEeTt";
$database="vpopmail";
$hostname="localhost";
$filename=$domainname."_gabook";
$global_abook="/var/lib/squirrelmail/".$filename;

// process
$handle = fopen($global_abook, 'a');
$conn = mysql_connect($hostname, $username, $password) or die ('Error 
connecting to mysql');
mysql_select_db($database);

$query="select pw_name,pw_gecos from $tablename";
$result = mysql_query($query);

while(list($email,$name)= mysql_fetch_row($result))
{
$data=$email."|".$name."||".$email."@".$domainname."|\n";
fwrite($handle, $data);
} 
mysql_close($conn);
fclose($handle);
?>
#!/bin/bash
# squirrelmail global address book updater
# [EMAIL PROTECTED]
# ver 0.1 (2 Aug 2007)
# - initial script
# ver 0.3 (3 Aug 2007)
# - add full path and test if php script exist
# - add detail documentation
# 
# need more enhancements
# - use 2 script to create one global address book, if it were only 1 script it 
would be simpler
# - these scripts only can generate one global address book for one domain
# - and thus 1 global address book is configured with your Squirrelmail
#   so if your webmail support multidomain, the global address book didn't
# - can't update dynamicly if there are changes in email account and/or milist
#   you have run it again via cron (weekly/daily)
# - user which his email address listed can't update his info
#   (I am setup my squirrelmail with policy no one can change global address 
book)


# variables section edited here
# your domain
DOMAIN="pala.bo-tak.info"
# where this bash and php script reside
SCRIPT_LOC="/root/scripts"
MILISDIR="/home/vpopmail/domains/$DOMAIN"
FILENAME=$DOMAIN"_gabook"
GLOBAL_ABOOK="/var/lib/squirrelmail/$FILENAME"

#===========================
# process here
#===========================
echo "#Squirrelmail global address book updater..."
rm -f $GLOBAL_ABOOK
touch $GLOBAL_ABOOK

# export email address 
# make sure sqweb_gabook.php is in same folder
# there are some variable inside it please change them to suit your need
if [ -e $SCRIPT_LOC/sqweb_gabook.php ]; then
        php $SCRIPT_LOC/sqweb_gabook.php
fi

# export milist
CWD=`pwd`
cd $MILISDIR
for milisname in $(ls -1);
do
     if [ -e $milisname/config ]; then
        echo "$milisname|$milisname|MailingList|[EMAIL PROTECTED]|" >> 
$GLOBAL_ABOOK
     fi
done

cd $CWD
echo "Global Address for $DOMAIN is available at "$GLOBAL_ABOOK
echo "Enter the fullpath using Squirrelmail config utility"
echo "select 6. Address Books option and configure address book in 3. Global 
file address book"
echo "More info: http://www.squirrelmail.org/docs/admin/admin-7.html#ss7.5";
echo "To provide latest global address book in your Webmail you may want run 
this script weekly via crontab"

---------------------------------------------------------------------
     QmailToaster hosted by: VR Hosted <http://www.vr.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to