Jake Vickers wrote:
Naveen wrote:

Hi List,

Is there any way to export the present email address details in csv format to Qmail toaster?

Right now I am running Alt N MDaemon , from this I can export all users details for all domain in to CSV format.

I would like to know is there any way or is it possible to import from csv to Qmail toaster?


Sure. You'd have to do some scripting to read each line as an email/pass separated by a comma, but that should not be too difficult. Look in the email archives - I seem tom remember someone posting a piece of script to do this already. If not, I'll dig through my old scripts and see if I have anything, or you can whip something up.

you can use my sqweb_gabook.php script, it is part of my sqweb_gabook.sh script to provide global address book within squirrel you may need to change a litte bit, like what fields do you want to fetch from tables and what delimiter you will use (here I use pipe "|")
script below, feel free to modify

-----------
<?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);
?>



---------------------------------------------------------------------
    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