Search:  
Gentoo Wiki

HOWTO_Migrate_to_Gmail

We all love Gmail. Huge storage, nice interface, and great search capabilities.

In this guide we are going to set up both Hotmail and Yahoo Mail forwarding servers, which will send all our mail to our gmail account (or any other account for that matter)


Contents

Hotmail

For Hotmail we will use gotmail.

Code: Getting gotmail
emerge gotmail

Gotmail by default looks for ~/.gotmailrc as a configuration file.

File: .gotmailrc
username=
password=
forward=
delete

Fill in the necessary information. gotmail --help will give you plenty more options to choose from. Configure as you like. Note: If you do not have a working sendmail, you will need to specify an smtp server.

Before running gotmail, we want to make sure our gmail account is ready. Add a filter which will tag all files with the label Hotmail. You may also want them to be archived automatically, perhaps only for the first time gotmail is run. (All your email will be received as new mail and will clog up your inbox.)

With everything configured, run gotmail. It will take a while, but upon completion it will have transfered all your email to your gmail account.

Yahoo Mail

For Yahoo Mail, we will use fetchyahoo.

Code: Getting fetchyahoo
emerge fetchyahoo

The configuration is found in /etc/fetchyahoorc and is well commented.

We should setup the same gmail filters as we did for hotmail. (above)

It works just like gotmail.


Continual Use

So they work great as standalone programs, but how can we get them to continually forward our mail?

I found two solutions.

Setting up a Cron Job

Nice and simple. Setup a Cron Job to run as often as you see fit.

Setting up as a Service

Why can't we set up a system service instead. Benefits: Easily managed, can be turned off just as easily as it is turned on.

I'm sure there is a better solution, but this is the one that I came up with.

Requirement: at (scheduled command daemon)

.gotmailrc was moved to /etc/gotmailrc

File: /etc/init.d/webmaild
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/mail-mta/postfix/files/postfix.rc6.2.2.9,v 1.1 2006/03/07     21:07:20 ferdy Exp $

opts="${opts} reload"

depend() {
        use sendmail net atd
}

start() {
        ebegin "Starting webmaild"
        /usr/local/sbin/webmaild &>/dev/null &
        eend $?
}

stop() {
        ebegin "Stopping webmaild"
        killall webmaild
        eend $?
}

reload() {
        ebegin "Reloading webmaild"
        killall webmaild
        /usr/local/sbin/webmaild &>/dev/null &
        eend $?
}
File: /usr/local/sbin/webmaild
#!/bin/bash
gotmail -c /etc/gotmailrc
fetchyahoo &> /dev/null

sleep 30m
/usr/local/sbin/webmaild &> /dev/null &

Not the most elegant solution, but it works. Now I can run webmaild as a service, and my email is forwarded every 30 minutes.

An alternative to the previous shellscript:

File: /path/to/whatever/webmaild.sh
#!/bin/sh
while true; do
    gotmail -c /path/to/gotmailrc &> /dev/null
    fetchyahoo &> /dev/null
    # add additional forwarders &> /dev/null
    sleep 30m
done

Basicly runs forever in a loop.

Kill it by issuing a kill:

Code: kill.my.server.now.please.sh
kill `ps aux | grep webmaild.sh | awk '{ print $2 }'`
Retrieved from "http://www.gentoo-wiki.info/HOWTO_Migrate_to_Gmail"

Last modified: Fri, 05 Sep 2008 10:05:00 +0000 Hits: 9,745