LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-17-2008, 11:50 AM   #1
dablew
Member
 
Registered: Oct 2006
Distribution: CentOS | Fedora | Mint | Ubuntu
Posts: 43

Rep: Reputation: 15
Combine Mail Boxes


Hi,

I had a mail server on postfix with mailboxes@/var/spool/mail.
Recently a new server was brought in to replace this server and unfortunately the replacer forgot to transfer the users,mail directories and files from the old server to the new server.They opted to create afresh all these in the new server but used the same setup - postfix with mailboxes@/var/spool/mail.
Mails have already accumulated in the new server while the old one was offline;I need to know how I would integrate the old mail boxes to the new mail boxes and have all in order and operating perfectly.
(I want the old and new mails to reflect in the new server & in the same mail box)
Combine:
oldserver#/var/spool/mail/userA to Newserver#/var/spool/mail/userA

and also user directories:
OldServer#/'userAdirectory'/mail to Newserver#/'userAdirectory'/mail

The main factor to consider here is that there are loads of new mails in the new server since replacement and I would not want to overwrite the new with the old files.

i,How would I do this?

ii,Is there a way one can 'export' mails from a system-user based mail system to database based mail system.I would like to have the mails on mysql and managed through postfixadmin preferably.My problem is how to get the system mailbox stored mails to the db.Would really value your inputs.

Thanks in advance.

Last edited by dablew; 09-17-2008 at 11:51 AM.
 
Old 09-17-2008, 11:57 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
i,How would I do this?
See man cp especially the -i option
Quote:
ii,Is there a way one can 'export' ....
I don't know.
 
Old 09-18-2008, 12:00 AM   #3
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
If the mailbox spools are mbox formats, they can be concatenated together. You must stop postfix and ensure no users are retrieving mail at the time you are perform the concatenation (i.e. no MUAs have the mbox's open).

Here is the basic procedure (I'll leave to you the transferring of old mbox spools from old machine to new):

( cat oldmbox ; echo ; cat newmbox ) > joinedmbox

This will concatenate the old and new mboxes with a blank line inbetween (which is used to separate mail messages in mbox format). You can then test the procedure with

mail -f joinedmbox

Once you have confirmed the mbox is correct, you can move the existing mail spool in /var/spool/mail/user to /var/spool/mail/user.prev and then move the joinedmbox to /var/spool/mail/user. Be sure the permissions are correct.

The same concept applies with user's mbox's in various ~/mail folders. Once you get the hang of it, you can script the operation, depending upon how many you have.

Make backups first before you destroy any data! This is why I concatenated data into a new mbox in the example above.

I don't have info re; importing mbox's into a DB.
 
Old 09-18-2008, 01:41 AM   #4
dablew
Member
 
Registered: Oct 2006
Distribution: CentOS | Fedora | Mint | Ubuntu
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
( cat oldmbox ; echo ; cat newmbox ) > joinedmbox
Mr. C.,this might work the magic for me.
Will definitely try it and giv u feedback.

About exporting mails to db,I was wondering if there was a way to create a database structure from system based mailboxes and be able to to retain all mails in to the new db setup.
I might be asking too much but if there's a person who has ever worked out something keep me posted.

Thanks again.
 
Old 09-18-2008, 01:46 AM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Or you can simply use formail to repost the mail after the DB is up and running. I don't have a DB-based email system here, so am not up on that.
 
Old 10-17-2008, 09:09 AM   #6
dablew
Member
 
Registered: Oct 2006
Distribution: CentOS | Fedora | Mint | Ubuntu
Posts: 43

Original Poster
Rep: Reputation: 15
Thanks Mr. C.,I was able to join the Files with your illustration 8~)!
LQ Community...gud spirit so far!!!
 
  


Reply

Tags
mailboxes



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail server - setup virtual mail boxes satimis Linux - Server 1 02-10-2007 10:40 AM
virtual mail boxes setup satimis Linux - Server 1 01-22-2007 11:05 PM
Multiple Boxes to Combine CPU-Power wwnexc Linux - Networking 6 01-24-2006 10:36 AM
mail boxes for members rblampain Linux - Software 5 08-05-2005 10:05 PM
Why doesn't Cyrus put mail into boxes? mpjones Linux - Software 2 08-16-2004 05:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration