Results 1 to 2 of 2
Hi all,
I've done converting a dedicated postfix email server that uses pam authentication to a multi-domain virtual host (still postfix) server. The new system is a fresh installation of ...
- 11-16-2008 #1Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
How to convert emails sent in webmin to squirrelmail "Sent" folder
Hi all,
I've done converting a dedicated postfix email server that uses pam authentication to a multi-domain virtual host (still postfix) server. The new system is a fresh installation of OpenSuSE 11.
I've done converting accounts and mboxes to Maildirs.
The old system uses usermin and I have to use squirrelmail for the new system because usermin only suports system accounts and I am using mysql as the user and password backend for the new system. Now the problem arises as I have not found out a way to transfer the emails sent by usermin users to their new squirrelmail Sent folder. I can see there's a .usermin folder under each system user's home folder in the old system and some information such as addressbooks stored in clear text format which I can do the conversion with no problem but with email sent I have no clue.
Regards
- 11-18-2008 #2Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
Actually I found the answer today, the sent emails of each user are stored under ~/mail/sentmail in mbox format. All I need to do is to use the mbox to maildir conversion script (perfect_maildir.pl is the one I am using) in a for loop and save the converted emails to each users maildir under a subfolder .Sent which should be added to the subscriptions file as well. Here's the script
( the sentmails are compressed individually with the format username.tgz and sent to the new email server through scp )
Code:#!/bin/bash BASE=/home/vmail/myclientsdomain.com cd /var/tmp mkdir -p sm/{tmp,working,done} for u in *.tgz; do [ "`ls -A working`" ] && rm -rf working/* [ "`ls -A tmp`" ] && rm -rf tmp/* #get username user=${u%.tgz} #extract file tar -xzf $u -C working mkdir tmp/{new,cur,tmp} /usr/local/bin/perfect_maildir.pl tmp/ < working/$user/mail/sentmail chown -R vmail:vmail tmp chmod -R 700 tmp #create .Sent folder and subscribe to it if it doesn't exist [ -d $BASE/$user/.Sent ] || { mkdir -p $BASE/$user/.Sent/{new,cur,tmp} chown -R vmail:vmail $BASE/$user/.Sent chmod 700 $BASE/$user/.Sent sub=$BASE/$user/subscriptions touch $sub grep -q "Sent" $sub || echo "Sent" >> $sub chown vmail:vmail $sub chmod 600 $sub } find tmp -type f -exec cp -p {} $BASE/$user/.Sent/cur \; mv $u done/ echo "done for user $user" done


Reply With Quote