Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    May 2008
    NYC, moved from KS & MO

    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.


  2. #2
    Linux User
    Join Date
    May 2008
    NYC, moved from KS & MO
    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 ( 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 )
    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
      #extract file
      tar -xzf $u -C working
      mkdir tmp/{new,cur,tmp}
      /usr/local/bin/ 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
           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"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts