Today I set myself the goal of centralizing all my email. Before I finished this change I had 50/50 POP email that was delivered to my home computer, and the other mail is sitting on an IMAP server.
For years (since 2006) I have had email stored between different POP clients, from Micro$oft Outlook Express, to their non-Windows XP Microsoft Mail client, and then finally importing it all to Thunderbird. After performing some experiments I comfortably learned that I can take a file stored in Thunderbird and have Dovecot read it perfectly with no issues.
With the way I have dovecot and sendmail set up, this process was actually quite easy to do:
- Create a system user, give it a password
- add that user to my “mail” group
- Verify that dovecot picked it up my connection to IMAP via telnet
- Configure sendmail to dump messages to that mailbox
- Reload sendmail
- Upload thunderbird messages and make sure ownership is set
That’s pretty much how simple it was. After reconfiguring Thunderbird to connect with the new IMAP user I was able to see all my email magically show up. As a minor bonus I don’t have to tie my “make a folder per mail message” routine into it since it’s my general dumb box, and i’ll just manually search the inbox for necessary messages.
Some one-off copy-pasta for my future reference:
# Create the user
sudo adduser unliterate
# give it a password
sudo passwd password
# Add it to the mail group
sudo usermod -a -G mail unliterate
# Verify if dovecot sees the user and the mailbox
telnet unliterate.net 143
A login unliterate password
B select INBOX
C logout
# Configure sendmail to dump all messages to the unliterate box instead of the standard drop
cd /etc/mail/
sudo vi virtusertable
sudo ./make
# Reload sendmail
sudo systemctl restart sendmail
# See if the user is receving email
sudo tail -f /var/spool/mail/unliterate
# Upload up thunderbird messages to mailbox, verify ownership
cd /home/unliterate/INBOX
sudo cp /home/me/unliterate/* . && chown unliterate:unliterate *