[sylpheed:32343] From Sylpheed to gMail (and return)

Andrea Ganduglia radio at frequenze.it
Thu May 22 23:41:35 JST 2008


Hello, this mail describe a valid (?) and tested method for migrate
your emails from Sylpheed to gMail. It's not an enterprise or official
or end-user solution, it's an hack!

You can find more solutions here:
{{http://www.squidoo.com/gmailoptions}}, but most of this solutions do
not preserve original date of emails or work only under Windows or
required 3parts software.

Other good solution is here:
{{http://www.marklyon.org/gmail/default.htm}} but do not support date
preservation.

My solution preserve original date and, if you are comfortable on
command line, it's simple to implement.

== Overview ==

gMail allows to import emails from another account through POP3
protocol; you can add 1 to 5 POP accounts from ''Setting/Accounts''.
The basic idea of this solution is create a fake POP server on your
local machine pointed on your Sylpheed directories tree. When gMail
connects your fake POP server, it will receive your old emails.

== Motivations ==

>From 2003 I am a Sylpheed user. Recently I moved my domains on
DreamHost.com, that it allow to use gMail as mail server. In a short
time I loved gMail capabilities and I try to use only one gMail
account for manage all my emails, but I need to extend gMail features
to my old emails.

== Requirements ==

- patience
- a gMail account
- working Linux box with root password and PHP5
- good bash and sysadmin skills (you need to know what you do)
- some notions about PHP5
- a populated Sylpheed directories tree
- broadband connection with a public IP
- allow to NAT port 110 from router to your Linux box
- more patience

=== About connection, public IP and NAT ===

If you cannot use your machine, please consider to buy a virtual
machine. For this topic I bought a 1-share VM from Gandi
{{http://www.gandi.net}}. Gandi is currently under beta testing, and
you can buy a VM for less 8 EUR/month without automatic renew. It
works very well and it's inexpensive! Gandi VM with Debian 4 provided
all what you need.

== HOWTO ==

This HOWTO is tested ONLY under Debian 4.

1) Shutdown Sylpheed and backup (IMPORTANT) all your emails.

2) Download this script: http://www.openclose.it/source/pop3d/pop3d.php.v0.1.txt

3) mkdir -p /usr/local/bin/popd

4) mv pop3.php.VERSION.txt /usr/local/bin/popd/pop3d.php

5) cd /usr/local/bin/popd/

6) Create a shell script called `pop3d' as follow:

#!/bin/bash
/usr/bin/php /usr/local/bin/popd/pop3d.php

7) chmod 777 pop3d

8) mkdir -p /var/mail/sylpheed

9) Copy your Sylpheed directories tree into /var/mail/sylpheed

10) Be sure /var/mail/sylpheed and all its sub directories are
writable from nobody user. The quick, brutal and no secure way to do
this is chmod -R 777 /var

11) Now edit /etc/inetd.conf and add the following line:

pop3 stream tcp nowait nobody /usr/local/bin/popd/pop3d pop3d

Please note, if on your machine is present another pop3 server you
must disallow that!

12) ~# inetd /etc/inetd.conf (restart inet)

13) Edit /usr/local/bin/popd/pop3d.php and modify this line

define("DirToPoint","/var/mail/sylpheed/inbox");

with the first Sylpheed directory you want import into gMail. You must
repeat this step for any directory you want import (you need more
patience, remember?).

14) Now you can test your POP3 server:
~# telnet 127.0.0.1 110
And on prompt digit POP3 commands:
{{http://pages.prodigy.net/michael_santovec/pop3telnet.htm}} (you can
use any user and pass values)

You can follow your POP activities with ~# tail -f /tmp/pop.log

15) Now switch into your gMail accounts, and set new account as follow:
http://mail.google.com/support/bin/answer.py?hl=en&answer=21288

Your parameters are:
Email address: as you wish
Username: as you wish
Password: as you wish
POP server: your IP
Please mark:
- Label incoming messages: with as descriptive label (es. imported)
- Archive incoming messages: yes.

16) From now to when your stop your POP3 server gMail imports your old
mails with the original date-time.

=== Problems ===

- With this method I have imported about 6000 emails in few hours.
Only one message has no original date, but it have strange characters
onto headers. I have not investigated more.
- gMail seems use multiple connections: is a disaster for my fake not
full implemented POP3 server. Please, be careful /tmp/pop.lock.
- If you want, you can change "descriptive label", but pay attention:
gMail seems use a spool (or similar), and it could be generated wrong
marks. Wait to see all your emails into gMail before change
"descriptive label" and start new import.

== Return to Sylpheed ==

I said I use Sylpheed. And It's true. Now all my emails are on gMail,
then Google controls my data. Google is not evil, but it'sn't good in
any way. The first step after importing is backup!

gMail allows to use IMAP protocol for manage emails with your
preferred client, you can enable IMAP from "Settings/
Forwarding and POP/IMAP" tab. Follow this instructions for setup IMAP
account on your Sylpheed client:
{{http://mail.google.com/support/bin/answer.py?hl=en&ctx=mail&answer=75725}}

Now you can use gMail web mail or Sylpheed and your messages are safe!

== Notes ==

Please note that the method described above is not secure, when it's
run anybody can connects your POP3 server and slurp your messages.
Please, consider to modify pop3d.php with a basic authentication
method.

I appreciate any report.
Regards, Andrea -

-- 
ANDREA GANDUGLIA
http://www.openclose.it/
http://www.openclose.it/wiki/


More information about the Sylpheed mailing list