This page is about a Java email server that I modified for the purpose of creating temporary email accounts which I could use when I needed to provide an email address but did not want to get spammed. If you have any questions about this document, email me at email@example.com .
Sometimes there are sites that you want to visit, but they require that you create an "account" with a username and password. Of course, you must provide your email address. I refer to these types of sites as "they'll-SPAM-me-for-sure" websites. They SPAM you and then sell your email address so others can SPAM you too.
Provide a fake email address, you say? Sometimes this can work, but often they send a confirmation email to the address you give to ensure that it is indeed you, then once you reply or click on a hyperlink embedded in the email- only then can you access the site fully.
At www.jps.at/java/tools/mailserver.html I found my solution. They had a Java email server under the GNU Public License (GPL'd as they say) which means that you and I are free to make modifications as we see fit. The idea was that if I had my own email server running on my computer, I could create a temporary email address for the they'll-SPAM-me-for-sure websites' account creation and then destroy the email account after receiving their confirmation email and either replying or clicking the enclosed hyperlink (whichever method they use). If you have a static IP address, then you can use any email server for this task including the unmodified version they provide at www.jps.at/java/tools/mailserver.html. Simply install the email server, set the "local domain" value to your static IP address (or DNS name if you have one, like www.yoursite.com). Then create a user account and once you've used it at the they'll-SPAM-me-for-sure website, remove the user account. Then when they try to SPAM you, your email server will give them a message like 'user x does not exist here' and close the connection in their faces.
Since I am a dialup modem user (sad but true), I have a dynamic IP address picked from a pool of addresses by ATT Worldnet, which is my ISP. The email server is trying to receive mail for one IP address and it's inconvenient to reconfigure the email server every time I dialup. Here's where my modifications come in, my version now ignores the "local domain" setting and instead looks for an IP accessible from this internet. What this means is that if you have a network card in your machine and it has some given IP address for a local network (i.e., an IP address like 10.x.x.x or 192.168.x.x is a local network IP and is not visible from the Internet), then this is not the IP address you want the email address to work on. When you dialup to the internet through your ISP (or if you have DSL or Cable, static or dynamic IPs), they'll assign you a new IP address. However, I use dialup so I have not specifically tested it with DSL or Cable internet connections, but they should work. If you have a static IP, then if you like, you can use the unmodified version at www.jps.at/java/tools/mailserver.html and set the IP address with the configuration tool. If you don't know what a static IP address is, or you don't know if you have one, don't worry about it since my version will work with either type. If you use the original version (or mine) and you want to make changes to the code, see my compilation notes below.
I should mention that in my search for an email server to modify for this purpose, I came upon a couple websites that offer a service of temporary email accounts for the same purpose. The two I found (the search turned up more, but I actually looked at these two) are www.spamhole.com and www.spamgourmet.com. They take your real email address and then give you a temporary address that you use at the they'll-SPAM-me-for-sure websites. They forward the email to your real address for a limited amount of time like 2 hours or a day. The problem I see with this is that when you reply to the confirmation email (if you have to), then the they'll-SPAM-me-for-sure website will have your real email address- if their software is clever, and it could EASILY be. With my solution, they SPAMers will never see your real email address. That said, spamhole promises that they will never sell or give away your real email address and they don't even keep your email address themselves (spamgourmet probably does also, but I didn't take the time to look), and for those who don't want to bother installing an email server on their computer then one of these websites is the fast/easy option which will probably (but not certainly) protect you from the SPAM sites.
So you want your own email server for the best anti SPAM protection. I'm making my modified version available, also under the GNU Public License (which is required of software derived from other GNU Public License software). This means you are free to use and modify the code, and I provide a compiled version that you can use right away and also the source code so that you may make further changes. Here's the disclaimer:
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You can read about the GPL here: http://www.fsf.org/copyleft/gpl.html.
If you agree to the disclaimer, then you can download either this zip file (if you don't know what a jar file is, choose this one) or this jar file (so anyone on any platform can get the necessary files). The files are about 356KB because I included the source files and the .class files so you don't have to compile them all yourself, see my Compilation section below if you want some help getting that going.
Here I'm going to describe the EASY steps to getting this running without messing around with the source code. These steps are for a Windows machine, however, since it is java that means that those of you running linux or a Mac should be able to use it, but I have only tested on Windows. For the other OSs, you just have to see the config.bat file and the jmailsrv.bat file and make a version on your OS that executes the lines starting with "java". This should be very easy, maybe I'll do it for you if I get around to it.
A few things to note:
I had a little trouble getting the code to compile that I got at www.jps.at/java/tools/mailserver.html. I tried to email the guy at the address provided on the site, but the server rejected the email and said he was an "inactive user". I saw another email address JMailSrv@jps.at for him in comments in the code files, but I never tried it.
Here are the problems I had (if you download the original code to make modifications, this will help you since there are no hints/instructions along with the original code):
If you download my version of the program, I include the already compiled .class files so you don't have to go to each subdirectory and compile them. I also include a file in the MailServer folder called compile.bat, you will need to edit the "g:\myjava\jmailsrv" path to be your path which holds the "at" folder. Then you can use this command to compile the MailServer folder, after you have copied j2ee.jar to this folder. You can get this file from Sun.
My first version just looked for the last IP address in the list on your
computer. However, ONCE while I was using it the last IP was not the right
one. I changed the code to filter out IP addresses like
"10.x.x.x" or "192.168.x.x" which are local IP addresses not
visible from the internet. The files you can download now are this
version. When the server starts there is a line in the output which says
"Jesse Pangburn modifications test V2" instead of the previous version
which said "Jesse Pangburn modifications test"