LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-24-2022, 12:59 AM   #1
brokenkeys
LQ Newbie
 
Registered: Jul 2019
Location: Croatia
Distribution: Artix, Archlinux, Xubuntu
Posts: 20

Rep: Reputation: Disabled
Email server to database


I have 8. year old email server (CPanel) that is around 100GB.
Because of costs I need to archive the whole thing somehow.

Only acceptable way is for me to get the 'Mail' directory from CPanel
and turn it into searchable database. So that for example, I can query
for user at date and get attachments.

Is there any solution that can help me with this or I'm going to
need to somehow turn 'Mail' directory into SQL database and I don't
even know how I'm going to handle attachments that are stored in text files?

Help pls!
 
Old 10-24-2022, 03:40 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,767

Rep: Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765Reputation: 2765
Quote:
Originally Posted by brokenkeys View Post
I have 8. year old email server (CPanel) that is around 100GB.
Because of costs I need to archive the whole thing somehow.

Only acceptable way is for me to get the 'Mail' directory from CPanel
and turn it into searchable database. So that for example, I can query
for user at date and get attachments.

Is there any solution that can help me with this or I'm going to
need to somehow turn 'Mail' directory into SQL database and I don't
even know how I'm going to handle attachments that are stored in text files?

Help pls!
Why not disable SMTP delivery (listen locally only) and sending outside the host, back it up, and leave it running otherwise just as is. This way you can use email clients to read that mail. That way attachments would still be there, and work as they always have.

If one REALLY wanted to get tricky, one might even be able to make that mail directory be read only and have it still work, but I would want to perform several tests to verify that nothing would break doing that.
 
1 members found this post helpful.
Old 10-25-2022, 02:16 AM   #3
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Run a local IMAP server and transfer the mail to that.
Or just download it with a local mail client.
 
1 members found this post helpful.
Old 10-25-2022, 07:53 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,753

Rep: Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983Reputation: 7983
Quote:
Originally Posted by brokenkeys View Post
I have 8. year old email server (CPanel) that is around 100GB. Because of costs I need to archive the whole thing somehow.

Only acceptable way is for me to get the 'Mail' directory from CPanel and turn it into searchable database. So that for example, I can query for user at date and get attachments.

Is there any solution that can help me with this or I'm going to need to somehow turn 'Mail' directory into SQL database and I don't even know how I'm going to handle attachments that are stored in text files?
I'd agree with the option of running a local IMAP server and dumping to it. But if you REALLY need a genuine SQL database, you can use perl or python with an IMAP module (imaplib for Python, Net::IMAP for Perl), and write a program to parse things. Can easily get the sender, recipient, message body, and attachments. From there, shove them into a DB table. Attachments can be inserted as blobs in a database.

You're going to have to code this yourself.
 
1 members found this post helpful.
Old 10-25-2022, 12:26 PM   #5
brokenkeys
LQ Newbie
 
Registered: Jul 2019
Location: Croatia
Distribution: Artix, Archlinux, Xubuntu
Posts: 20

Original Poster
Rep: Reputation: Disabled
Thanks guys!

Ill be back if I get stuck.
 
  


Reply



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
LXer: How to create a MySQL Database Server and Database in Azure Cloud LXer Syndicated Linux News 0 01-27-2022 06:54 PM
[SOLVED] Best email client for moderate to large email database (Evolution, thunderbird, kmail, Claws mail) Carpincho Linux - Software 1 08-24-2011 05:19 AM
How can i copt the MYSQL Database to a other server (Database) halvorls Linux - Server 3 07-27-2008 09:19 PM
Database Programming (database to database transaction) johncsl82 Programming 7 02-02-2007 08:20 AM
Migrating from Lotus Domino Email Server 6.5 to Linux email Server sailu_mvn Linux - Software 0 08-22-2006 11:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:12 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