If you’ve been on the Internet for any extended period of time, you’ve probably felt annoyed at all the websites that require your email, and sometimes even put annoying checks on them.
Common Annoyances
- Requiring an email address and then sending a confirmation link.
- Websites that send their “free information” through email in a ploy to get your email address.
- Websites that reject all the free email providers. (You must provide a real email address, why is a free one not real??)
I hear half of you saying “you can use free disposable email websites”. This is true. A simple search on Google will bring up a long list of them.
However, I’ve increasingly found the websites to be offline, blocked by websites, or not receiving any email whatsoever.
So why not host your own email server? Well I looked around online, and found myself completely annoyed at the bulkiness and difficulty of setting up a simple catch-all, so I decided to make my own and share it with all of you.
Solution
The following code is written in Python. If you do not have Python, you may download the Windows executable below.
Click here to download “Easy Email Host: Enhanced Windows Version including source code”.
import smtpd, time, asyncore, os, sys, urllib, re class Receiver(smtpd.SMTPServer): def process_message(self,peer,sender,recipient,data): print 'Received Message To %s From %s' % (recipient, sender) if 'mail' not in os.listdir(os.getcwd()): os.mkdir('mail') try: f = open('mail/%s.txt' % time.time(), 'w') info = "%s\r\n%s\r\n%s\r\n%s" % (peer, sender, recipient, data) f.write(info) except: print "Error: could not write to disk." finally: f.close() def loop(host): a = Receiver(host,('',0)) try: asyncore.loop(timeout=0.5) except KeyboardInterrupt: print 'Abort' sys.exit(0) if __name__ == '__main__': print 'Easy Email Host by codexon.com' print 'Emails are saved in the "mail" directory' print 'Press Crtl+C to quit\n' loop(('0.0.0.0',25))
Here is a picture of the enhanced version in action which simply includes automatic external IP address locating and a check to make sure your port is open.
Here are the instructions.
- Open your firewall or NAT at port 25.
- Run the program.
- Emails are saved in the “mail” directory as text files.
If for some reason you don’t have a “domain name” for your IP (which almost everyone has including Comcast and Verizon customers), you may go to http://www.dyndns.com/ and point one of their domains to you IP address for free. This is also useful for getting different email names.
I used this script to create multiple Facebook accounts back when they required email addresses from an Ivy. It definitely works.
Related posts:









hi unable to download from the link above. would like to learn from it easy email host sounds great
Hello Kamran, for some reason it was removed. I will try to upload it again.
“If for some reason you don’t have a “domain name” for your IP (which almost everyone has including Comcast and Verizon customers)”
I am a Comcast customer; how do I figure out what this “domain name” is? Does Comcast really have something akin to dyndns?
If you download the application, it will automatically figure that out for you.
Otherwise you can go here: http://www.displaymyhostname.com/
It will give you a “domain name” such as
c-70-200-15-53.hsd1.nj.comcast.net
To receive e-mail you need MX record in dns for that domain name pointing to your IP. Definitely no ISP sets this up for you.
All email senders will default to the A record if no MX record is present. There is no need for an MX record.