GotMail is a very nice Perl-script written by
Peter Hawkins (peter AT hawkins.emu.id.au)
that provides you with an easy way to retrieve all
your hotmail-accounts and delivers them to a local account or another e-mailaccount.
As of may 2002 the project is maintainted by Paul Cannon (check it out at
Paul has been the maintainer for Debian packages for a while and has released a new version that can
cope with the recent Hotmail changes.
First of all, what is GotMail?
I quote Freshmeat.net
GotMail is a Perl script which downloads mail messages from a HotMail account and either
saves them to disk or forwards them to another email address. It can either be used to
transfer all the mail out of an account for backups, or on a regular basis to use a
HotMail address as a forwarding account.
GotMail has its own home-page at
Another useful place for information is at
There are some packages that need to be installed before you can get GotMail up and running.
First of all, you need to make sure you've got a recent perl-compiler (minimum Perl 5). You
can check this with
Next, you need to install Curl-SSL version 7.9.8 or later. If there's no current version available for your distribution,
you can try by building one from the src-rpm and installing it afterwards.
rpm -ba /usr/src/redhat/SPECS/curl.spec
The last thing you need is the URI-CSPAN-module (an extra perl-module). This can be downloaded from
rpm -ivh /usr/src/redhat/RPMS/i386/curl-* --nodeps
Untar this package and move it to the newly created directory
tar zxvf URI-1.12.tar.gz
Now, install this module.
First step is to download the latest version.
http://ssl.usu.edu/paul/gotmail/gotmail_0.7.0.tar.gz. I prefer downloading
and install this into /usr/local/src/.
Untar this package and move to the newly created directory
That's all for the installation. There's no other configure or make involved.
If you don't want to install the source, you can always download either the RPM of the Debian package.
If you use Gentoo then a simple 'emerge gotmail' will do the trick. This will install two packages, dev-perl/libnet and
The easiest way, in my humble opinion, is to place all directives in one script
and start everything from a cron-job.
I'll give you an example of my script.
The first line speaks for itself, it just starts the Perl-script.
The - u directive tells GotMail which Hotmail-account it should use and
according to this, with - p you can send your password.
Beware! When you're running this from a script make sure the script file that contains
your settings (and your hotmail-password) is NOT world-readable!
For better perfomance, you could use a proxy-server with --proxy.
This is done with
With --folders you can specify which folders need to be accessed.
Seperate the different folders with a colon , for example like
--folders "Inbox, Special_Stuff, Spam_Mail
When you want to forward the mail to another mail-account you can do this with
-f. Either you specify a full mail-address (email@example.com) or
just a local account (make sure your mail-configuration is accepting messages
and the provided e-mailaddress is correct, otherwise there could arise some bumping around).
-f johndoe (localaccount)
If instead of delivering them to a local account you'd like them to be saved in a directory,
you can do this with --folder-directory as in
-f firstname.lastname@example.org (external account)
With the directive --only-new-messages you tell GotMail to collect only
the new messages (this makes sense doesn't it?).
After reading the message GotMail can mark the message as read with
You can delete the downloaded (and ONLY the downloaded) messages with
A last word that concerns the configuration is a possible error-output with some versions
of Perl. When you receive output like this :
main::getPage() called too early to check prototype at /usr/local/src/gotmail/gotmail.pl line 432.
To avoid these messages, open the Perl-script itself, gotmail.pl and remove the
- w from the first line.
main::getFolder() called too early to check prototype at /usr/local/src/gotmail/gotmail.pl line 643.
One final note, take a look further down the page for some security issues if you're on a multi-user system
(even if you're not it's not a bad practice).
I first ran this script from /etc/crontab but for some reason this gave back some errors
from the curl-library. When I tried it from the command-line (logged in as root) everything
worked fine. I suspected the PATH had something to do with this. Either
you can change the PATH-variable in your /etc/crontab, you supply the right PATH in your gotmail-script
or you just make a seperate file in /etc/cron.hourly.
I prefer the seperate-file-way because when you change the PATH variable in /etc/crontab this counts
for every job and you'll never know what comes out then (hmmm...as a good sysadmin you should know).
Best way to get the correct PATH-variable is to login as root and then issue
Now in the script that starts GotMail in /etc/cron.hourly you just need to
supply the variable
PATH=/usr/bin:/usr/sbin.....................rest of your path
That would be all. Some remarks however:
The way I've outlined the use of Gotmail, allows other users to view the username and password
(either in the process-list or in the script-source). A better way would be to use a file
- Mail in the Sent Messages or Drafts folders cannot be saved at the moment
- Mail in the Trash Can will not be downloaded
- If the page structure of HotMail is changed, this script may stop working.
If that happens, annoy the author for a new version
.gotmailrc with read-only permissions (0600, -rw-------) and put all your configuration stuff
(username/password) in there.
In stead of using Gotmail for retrieving mail, you can access your Hotmail or Yahoo mailbox 'directly' through the use
of Hotwayd. This package is available for download from
Hotwayd is in fact an emulation of a POP-server that acts as a gateway between your account and the services of Hotmail or Yahoo.
Extract the package, compile and install it.
Usage is very easy, just create a
hotwayd file in
/etc/xinetd. and restart xinetd. This is how my hotwayd file
looks like :
disable = no
type = unlisted
socket_type = stream
protocol = tcp
wait = no
user = nobody
groups = yes
server = /usr/local/sbin/hotwayd
#server_args = -p http://proxy:8080 -u proxy_user -q proxy_password
port = 110