|
In this article we are going through the steps on how to export e-mails from DBMail mailserver to Maildir format in a Linux VPS. More specifically, the tutorial explains how to export the e-mails from an SQL database to Mbox format and then convert the Mbox e-mails to Maildir.
Let's say a word or two for each of the components being involved, shall we?
What is DBMail? DBMail provides fast and scalable SQL based mail services. It stores the mail messages in a relational database such as MySQL, PostgreSQL, Oracle, and SQLite. It has the following frontends IMAP4, POP3, ManageSieve and LMTP
What is Mbox? Mbox file is the most common format for storing email messages on a hard drive. All the messages for each mailbox are stored as a single, long, text file in a string of concatenated e-mail messages, starting with the From header of the message. MBOX files were used predominantly on Unix.
What is Maildir? Maildir e-mail format is a common way of storing e-mail messages, where each message is kept in a separate file with a unique name, and each folder is a directory. The local filesystem handles file locking as messages are added, moved and deleted.
0. SSH TO YOUR DBMAIL LINUX VPS First thing to do is to login to your dbmail virtual server via SSH and optionally fire up a screen/tmux session. For example:
ssh YOUR_VPS_IP -p YOUR_VPS_SSH_PORT screen -U -S dbmail-export-screen
1. EXPORT EMAILS FROM DBMAIL To export emails from DBMAIL, we're going to use the dbmail-export tool provided by DBMAIL itself. The tool supports multiple arguments and parameters (see dbmail-export --help), but in this case we're going to export all emails for a given account and period of time and also mark these emails as DELETED so dbmail-util can purge them from the database.
First off, let's setup some shell variables such as EXPORT_USER, EXPORT_DIR, DATE_FROM and DATE_TO:
EXPORT_USER=foo.bar EXPORT_DIR="/home/${ EXPORT_USER}__dbmail_mail_export" DATE_FROM='1-May-2016' DATE_TO='1-Jul-2016'
once the variables are set, run the following commands:
mkdir -p "${EXPORT_DIR}" cd "${EXPORT_DIR}"
and then execute the dbmail-export tool to export the emails from the database:
dbmail-export -v -D -u "${EXPORT_USER}" -b "${EXPORT_DIR}" -s "1:* SINCE ${DATE_FROM} BEFORE ${DATE_TO}"
keep in mind though, that you may want to adjust the parameters used according to your needs. for example, if you want to export all emails for a given user not just for some period of time, you can safely omit the -s argument and its parameter
if everything went fine, you should have the emails exported in MBOX format within ${EXPORT_DIR}. What you have to do now is to convert the exported emails from MBOX to Maildir format using a simple PERL script.
Navigate to your home user directory and download the mb2md script using the following commands:
cd - wget https://vpsineu.com/wg et/mb2md.pl chmod +x mb2md.pl
Once the script is downloaded, convert the exported dbmail e-mails from MBOX to Maildir by executing:
./mb2md.pl -s "${EXPORT_DIR}/${EXPORT_USER}" -R -d "${EXPORT_DIR}/Maildir"
verify the Maildir tree is OK:
ls -laht "${EXPORT_DIR}/Maildir"
2. TRANSFER THE EXPORTED EMAILS Next, setup some other shell variables such as 'destination host', 'destination user' and 'destination path':
ARCHIVE_HOST=1.2.3.4 ARCHIVE_USER=foo.bar ARCHIVE_PATH="/home/${ARCHIVE_USER}/${EXPORT_USER}_Maildir"
and then transfer the Maildir emails to your another server using your preferred tool (rsync, scp, ftp etc.). For example, we are using rsync over SSH as in:
rsync -Wav -e 'ssh -p22' "${EXPORT_DIR}/Maildir/" "${ARCHIVE_USER}"@"${ARCHIVE_HOST}":"${ARCHIVE_PATH}/"
3. FINIALIZE THE MIGRATION Now, SSH to the archive/another mailserver and finalize the email migration by moving the Maildir directory to the configured emails location and setup proper permissions and ownership:
rsync -Wav /path/to/the/transfered/maildir/ /var/vmail/foo.bar/Maildir/ chown -R vmail:vmail /var/vmail/foo.bar/Maildir/
of course, you have to tune the above paths to match your setup
4. ACCESS THE ARCHIVED EMAILS The final step is to try to access the migrated emails via your webmail system or by using an IMAP client like Thunderbird for example.
Full Story
Lihat Sumbernya → How to export e-mails from DBMail mailserver to Maildir format in a Linux VPS
Download MP3 Terbaru → Gesang Mp3 Download
Blog Archive
-
▼
2016
(121)
-
▼
July
(24)
- Bluehost Web Hosting
- 12 Open Source/Commercial Control Panels For Virtu...
- Multiplay to host Titanfall 2
- Joes Datacenter $20/month Dual L5420 w/ 8GB RAM...
- How to export e-mails from DBMail mailserver to Ma...
- ServerMania Introduces A Generous New Affiliate Pr...
- VPS Hosting Guide: How to Choose the Right Operati...
- Server hosting Cerber ransomware shut down
- Everleap Launches Managed SQL Server 2016 Hosting ...
- Future Hosting Announces Biggest Ever Loyalty Upgr...
- LoveServers KVM & OpenVZ SSD VPS Starting @ $25/...
- THE HOST a more affordable media server from CLO...
- Building an ASP.NET Core web app for a Linux VPS: ...
- DediStation DDoS Protected OpenVZ VPS Starting @...
- Its All About Choices: Incredible PBX ISO Now Ava...
- How to host multiple websites on Apache2
- Shout Out: Hansol Kang, host and server at Pho An ...
- How-to Restore vCenter Server VM with Veeam Instan...
- Building an ASP.NET Core web app for a Linux VPS: ...
- Dedicated hosting vs VPS hosting
- The five best and worst VPs in recent history: Column
- VirMach SSD OpenVZ & KVM in 8 locations starting...
- Virmach SSD OpenVZ & KVM in 8 locations starting...
- 6 Best Dedicated Server Hosting Providers of 2016
-
▼
July
(24)
Total Pageviews
Search This Blog
Popular Posts
-
Cerita liburan, cerita liburan ke bali, cerita liburan ngentot, cerita liburan sekolah, cerita liburan ke pantai, cerita liburan bibi mama, ...
-
Kisah nabi musa as lengkap, kisah nabi musa as, kisah nabi musa membelah, kisah nabi musa as lengkap, kisah nabi musa full film, film kisah ...
-
Dp bbm, dp bbm terbaru, dp bbm lucu, dp bbm semangat kerja, dp bbm bergerak, dp bbm bergerak taekwondo, dp bbm lucu terbaru, dp bbm terbaru ...