ImapSync Script Automate Qmail to Zimbra

 To synchronize the contents of your old email to the new email is actually quite easy, with tools like imapsync, but it would seem tedious to have to type each one syntack imapsync user account which will be in sync again what the user more than 100 people, not a fun job instead 🙂 ! hehehehe and because of the limitations I would regard coding bash shell scripts, alternatively looking at the wiki guide zimbra about scripts that can automate multiple users to synchronize and see the script from zimbra wiki 🙂 after trial and add parameters imapsync script is running normally

Berikut scriptnya :
#!/bin/bash

logfile=”salinemaildotlog.txt”

host1=202.202.202.202

#host1 is the source of the email addresses please replace with your mail server ip#

host2=192.168.50.77

#host2 is the address to which you receive from host1 can also ip ip public or local#

domain=abc.com
#domain is where email account is
#everything after @ symbol
#tulis domain anda dan yang pasti harus FQDN
###### Do not modify past here ######

date=`date +%X_-_%x`

echo “” >> $logfile
echo “————————————” >> $logfile
echo “IMAPSync started..  $date” >> $logfile
echo “” >> $logfile

{ while IFS=’;’ read  u1 p1; do
user=$u1″@”$domain
echo “Syncing User $user”
date=`date +%X_-_%x`
echo “Start Syncing User $u1”
echo “Starting $u1 $date” >> $logfile

#imapsync –host1  $host1 –user1 $u1  –password1 $p1 –host2 $host2  –user2 $u1  –password2 $p1 –ssl1 –ssl2 –noauthmd5  #

imapsync –nosyncacls –ssl1 –ssl2  –syncinternaldates –host1 $host1 –user1 $user –password1 $p1 –host2 $host2 –user2   $user –password2 $p1   –noauthmd5 –allowsizemismatch  –nofoldersizes –skipsize –fast

if use imapsync parameters above can not be run using imapsync options below

imapsync -host1  202.202.202.202 -user1 $user -password1 $p1 -host2 192.168.50.77 -user2 $user -password2 $p1-ssl1 -ssl2 -noauthmd5 -allowsizemismatch -nofoldersizes

date=`date +%X_-_%x`
echo “User $user done”
echo “Finished $user $date” >> $logfile
echo “” >> $logfile

done ; } < userlist.txt

date=`date +%X_-_%x`

echo “” >> $logfile
echo “IMAPSync Finished..  $date” >> $logfile
echo “————————————” >> $logfile
Cara Menggunakan :

1. Copy and paste the script to your linux shell sheelscript.sh save it and give it executable permissions

2. make file is as follows userlist.txt parametternya

nameuser; password (only user name and password only)

# If more than one user please add in the second row

I have test scripts on SUSE Linux Enterprise SP 2 with Zimbra OSE 8:04

Success runs without any fuss, for another distro should also be able to walk, the original script without the need to actually do modif can run smoothly

Source :sini

Hopefully Helpful for you
:

Advertisements

One thought on “ImapSync Script Automate Qmail to Zimbra

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s