What is a Mail Server
You know this. A mail server allows you to receive mails from other mail servers around the internet, provided you create user accounts. It also allows your users to send emails to other mail servers.
For this tutorial, we’ll use a solution that is freeware, and does its job perfect. I’ve been using it for about one year, for my local development in php.
1 Mercury/32 Mail Transport System 4.01a
This one directly from Pegasus Mail, by David Harris
Installation
This one is a little overwhelming, but once you’re done with it, the procedure for configure and get your server running becomes an easy, quick task.
Ill explain the steps carefully. Run the installer and press setup (this is a very simple self-extracting program, that leaves no trace in the registry, so to unistall, you simply remove the created folder in the installation)
- Press the button New Installation
- Since we wont be using support for Netware Networks, just press the button No Netware Support
- Now select the directory where you want to install Mercury (or simply extract the contents, as explained before). Recomended is the standard windows installation path C:\Program Files\Mercury. Press the button Ok, accept this directory
- Since the Mercury server can be used along with another mail client by the same company, Pegasus Mail (yes, the name of the company and the email client are the same), it asks you if you want to enable the support for such mail client. For reasons beyond the scope of this tutorial, we will not be using Pegasus Mail, so go ahead and press the button No Pegasus Mail integration
- Now it asks you for the directory where it should put the user mailboxes. Just leave it as-is (If you followed the recomended installation path, the it should show C:\Program Files\Mercury\MAIL). Press the button Ok, accept this directory
- Now it will ask you what protocol modules do you want to use. Basically, each one is a component in the form of a plugin, that will give you a given functionality. This is basically the core of the application. You can come back later and pick up the modules you want/require when you are more versed in these matters. For the moment just follow my advice to get this up quickly

Select only the modules Mercury S and MercuryP (the first and second ones in the list).
The first one will sit and listen from outside connections (aka when someone sends you an email to your own server), and everytime he receives one, this is put in the spool directory.
The second simply will allow your POP3 client (outlook, thunderbird) to read email in an account in your server.
Now press the button OK, continue installation - Press the button Install MercuryE. This is the module that will handle delivery of mail to outside servers (aka when you send email from your own mail server to someone in yahoo, google, etc…)
- Now it should ask you for a domain name. This is your domain name in case you have one (or get one free at some of those free dns services around the net), or your own IP. This one can be either 127.0.0.1 -localhost, for testing purposes only- or your actual IP adress assigned by your ISP (e.g 200.197.167.92).
The other field, postmaster, is simply what could be considered as the username in your machine that will act as the postmaster for the server, or what it is the same; the user who will get problem reports. Just use anything for the time being
This is an example figure. We will use your ISP assigned IP, so that you can test this with an online connection, and in case you dont have a domain name. In the postmaster field, you can leave "Admin" which is the default, if you want to.
Now press the button OK, continue installation, and we are ready to move on
- In this step, you will be asked about the relay controls. When you become familiar with relaying, you can chose the one that fits your needs. But for the moment, just press the button None
- Now its time to choose the Queue directory. Again, it should by default C:\Program Files\Mercury\QUEUE, then leave it as-is, and press the button OK, continue installation
- We are set. This is -at last
- the final step. So go ahead and press that button Install Mercury/32 to stop the suffering
- Now, as a the worthless note ever, press the Exit button to close the installer
Configuration
This is an easy step, compared with the installation process, believe me. So you can just relax, follow my instructions confortably, and you should have your server up and running in no time from this point.
So, run the server, which should have a submenu in the start menu, called Mercury for Win32; then pick up the item Mercury Loader
Now you should be presented with a window like this one, which is basically the control center of the application through the menus. You can see also 3 windows if you follow the instructions to the letter, each one represents respectively the Core Process that is the main module, and the POP3 and SMTP servers.

So, the next part if to create user accounts. Lets create one for this example. Go to Configuration-> Manage local users…, then press the button Add, and enter the details as required, like in the picture

Now press the button Ok and close the other window if you want to. And as you can see, now we have created the mail account billgates@200.197.167.92
There are two last things to do.
Go to Configuration->MercuryP POP3 Server, and simply fill in the field IP interface to use, in the case you’re using an IP and not a DNS.
So in the sample case we’ve been following around, this field needs to be filled up

Now do the same for Configuration->Mercury SMTP Server; i.e fill the field IP interface to use

Now all its left to do is to configure your mail client to be able to read/send mails using your newly created server and a user account.
Extra Configuration
What? There’s more?. Yep. In this section we will deal with two possible scenarios.
Scenario 1: Dynamic IP Address
Ok. What is a dynamic IP Address? Well, all dial-up users like myself, and some broadband ones, have what is known as a dynamic IP address asignation schema, which in plain english means you will have a different IP address every single time you connect to internet. This sucks. I know.
So, as you can see, we went through each of the installation/configuration steps pretending to have an example IP address, but everytime you connect to the internet, changes must be issued in order to update your mail server configuration.
Is there any solution for this? Yes. Check out the Help section at the end of this tutorial. For the time being, lets go over the wonders of Dynamic IP Addresses…
The first thing that needs to be done, is to update the corresponding values in the fields IP interface to use, revised in the last two images above.
So lets pretend your IP address is 200.197.167.92, but next time you connect to the internet your ISP assigns you a new one: 200.197.167.73


The next changes are located at Configuration->Mercury core module….
First one is on the tab General. Just change the field Internet name for this system accordingly

Now go to the tab Local Domains, select the second item, press the button Change entry, and enter the new value

Thats it. This needs to be done every single time you connect to the internet. Painfull I know
Scenario 2: Domain Name
So, you are a lucky one, and own a domain name. Domain names are basically ways for us human beings to remember internet directions easily. If I told you go to 64.233.187.99 that wouldnt make much sense isnt it? So, go ahead and type that in your browser URL bar. What show up in the screen? Thats right, our beloved google. Which means that IP address is google address, and www.google.com is simply google’s domain name.
Again, if you dont own a domain name and would like to have one, read the help section at the end.
Ok, so you have your own domain name, do you have to make all the "difficult" configuration stuff in the last subsection? Of course not. You wont have to change anything at all once you have configured the basics of your mail server.
Since it easier to explain how to install the mail server when you have a domain name, instead of showing you the changes required to use a domain name rather than an IP, go ahead and delete the folder C:\Program Files\Mercury, in case you already installed mercury and followed the instructions for using an IP 
No worries here, all aforementioned installation steps apply, with some minor differences. We will be using the example domain name www.billyboy.com
Step 8: Put your own domain name in the adecuate field
So the first two changes look like this

There is though one little thing to change when using a domain name. In order for the outside delivery to work, we need to add a valid dns lookup server (i.e so that you wont get an unresolved error for gmail.com, hotmail.com, etc…). So, we fill in the field Identify Myself As: in Configuration->MercuryE SMTP Client

2.1 Outlook (Mail Client)
Since Outlook is very popular, and is bundled in M$ products, such as Office, Ill explain the configuration. Its really simple, so hopefully there’s no much to explain.

Thats it. Basically, your account properties should look like that, in the case you’re using a domain name, otherwise just fill in the IP

We’re done here. Now you should be able to send/receive emails (thanks to the POP3 module) through your own server in outlook.
2.2 PHP Mail (For programmers)
Now, if you are programmer looking forward to learn php, it always comes in handy to have your very own mail server for testing. So Ill just show you a sample php script to send mail through your server. Im going to use the Apache HTTP Server with PHP. Both need to be installed and working for this script to work properly ![]()
Just FYI, Im running Apache 1.3.20 and PHP 4.3.10.
PHP Configuration
Open the file php.ini, likely located at c:\windows\php.ini. Now search for the line [mail function], and change the parameters in there accordingly (or fill them)
[mail function]
; For Win32 only.
SMTP = www.billyboy.com
smtp_port = 25; For Win32 only.
sendmail_from = admin@billyboy.com
Notice you can also use an IP instead of a domain name, or just localhost in case you are running the script locally, in the same PC where the mail server is.
Thats it. Basically, your account properties should look like that, in the case you’re using a domain name, otherwise just fill in the IP.
As you can guess by now, PHP uses the SMTP Server module to communicate with the mail server, and try to send mails through it.
The PHP Script
Made by myself, so do whatever you want with it, i.e public domain licensed. Not that its awesome in any sense…
File: mail.php
Sample Usage Script (Single destination email and plain text body)
File: use_mail1.php
Sample Usage Script (Several Destination emails plus html body)
File: use_mail2.php
Forewords
We’re done at last. Hope you learn something useful with this tutorial, since IMO, its always tricky for a beginner to get a mail server up and running easily.
Theres obviously more to learn (a lot!) but thats outta the scope of this short tutorial, so you’ll have to go ahead and figure it out for yourself or search in internet. Only this way you might become a succesful mail server admin someday.
![[blinklist]](http://www.tech2all.com/wp-content/plugins/bookmarkify/blinklist.png)
![[del.icio.us]](http://www.tech2all.com/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.tech2all.com/wp-content/plugins/bookmarkify/digg.png)
![[Facebook]](http://www.tech2all.com/wp-content/plugins/bookmarkify/facebook.png)
![[Furl]](http://www.tech2all.com/wp-content/plugins/bookmarkify/furl.png)
![[Google]](http://www.tech2all.com/wp-content/plugins/bookmarkify/google.png)
![[Mixx]](http://www.tech2all.com/wp-content/plugins/bookmarkify/mixx.png)
![[StumbleUpon]](http://www.tech2all.com/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://www.tech2all.com/wp-content/plugins/bookmarkify/technorati.png)
![[Twitter]](http://www.tech2all.com/wp-content/plugins/bookmarkify/twitter.png)
![[Email]](http://www.tech2all.com/wp-content/plugins/bookmarkify/email.png)








5:36 am on December 23rd, 2009 -
very useful for me ,thanks for sharing
5:28 am on December 7th, 2009 -
Very useful information. Helped me to setup my server. Thanks
5:26 am on September 22nd, 2009 -
tyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
8:44 pm on September 14th, 2009 -
hi guys, i'm just now looking at options to setup a mail server… can someone tell me, does this program run on XP or do i have to setup like a win2003 server for this to run? i didn't see any "requirement specs" on instructions…
3:23 am on August 28th, 2009 -
i need to set up a email
5:43 pm on July 12th, 2009 -
Very useful information. Thanks for this. You got a great blog .I will be interested in more similar topics.I’m very interested in CMS and all its related subjects.
8:36 pm on July 11th, 2009 -
Ok, I have read what I need to do but were do i download the programme?
2:15 am on June 9th, 2009 -
Very well written post however, I would recommend that you turn the No Follow off in your comment section.
Keep up the good work.
11:36 pm on March 14th, 2009 -
Didn’t know about it. Very nice information. Submitted this post to Google News Reader.
4:28 pm on August 21st, 2008 -
I have my domain “rocknolds.homedns.org” from dyndns.com and pointed this to my Modem/Router’s ADSL WAN public ip address given by my ISP. I also have configured this modem/router for virtual servers forwarding POP3, Web Server, SMTP, IMAP, FTP to my XP host sitting in my private network.
Web server and FTP server works fine.
But mail server seems not working. I tried to follow all the instructions above.
12:30 am on April 20th, 2008 -
my mail server is behind a router what should i do?
10:49 pm on April 14th, 2008 -
Trying to open a E-mail account but not responding ,because I don’t know servers adress
6:16 am on April 8th, 2008 -
Hi i was wondering i have a domain (hingsmaf.com) what do i put as my ip interface becuz i tried my ip and i can access it in outlook??? any help
1:45 am on April 4th, 2008 -
I have xampp1.6. All of my outgoing mail’s are in pending. And i don’t know what to do. i have set you settings. I have a IP in sted of a domain.
4:27 am on February 29th, 2008 -
Does the sendmail_path in php.ini not have to be set to the correct folder for the mail() function of php to work?
3:09 pm on February 28th, 2008 -
Thanks for your how to! Helped me save a lot of time and nerves
6:59 am on September 1st, 2007 -
Hi,
I have WAMP5 install pckg for PHP run show.
Packg has APACHY server & MYSQL.
I have installed & configure mercury as suggested.
I’m using IP address instead of domain name.
Still I couldn’t send mail. [:(]
Kindly suggest if u have any better solution to work with it.
7:11 am on August 30th, 2007 -
Hey I am new to servers, php and mysql type stuff. I just want to ask you a question for my future goal:
I want to setup a email service for the public like gmail, but for college students. I’m aiming for a setup very similiar to the gmail’s setup. How would I go about doing this?
I’m good with photoshop and html so the design work is taken care of, but I’m beginning to learn php programming.
3:52 pm on January 6th, 2009 -
jae Wrote:
Hey I am new to servers, php and mysql type stuff. I just want to ask you a question for my future goal:
I want to setup a email service for the public like gmail, but for college students. I’m aiming for a setup very similiar to the gmail’s setup. How would I go about doing this?
I’m good with photoshop and html so the design work is taken care of, but I’m beginning to learn php programming.
DID YOU EVER GET THE ANSWER TO YOUR QUESTON? IF YOU Do CAN YOU PLEASE SEND IT ME.. THANKS.
2:07 am on August 18th, 2007 -
If you are using a server locally and you get a message from the SMTP server about not allowing non-local mail, simply open up your MERCURY.INI file located in the mercury program folder and locate the section:
[MercuryS]
then at the bottom of that add:
Allow: 127.0.0.1
Paul.
11:08 am on May 10th, 2007 -
i cnt find the help section mentioned above abt solution deal with dynamic address. I am facing that problem, anyone can help???
1:37 am on April 19th, 2007 -
Hi Frank – if you haven’t changed the CNAME or MX records, don’t. If you have, just set them back by clicking ‘reset to default settings’
Then, in the ‘domain control center’, on the right hand side, you’ll see a link that says ‘manage email accounts’ click it
It should show you have one ‘credit’ to use. Also on that page is some pretty straightforward information on how to set things up, including the ‘catch all’ function.
After that’s done, all you have to do is configure your mail retrieval system (Outlook, or whatever) to take the mail from the server you’ve configured.
GoDaddy.com has plenty of support as well as far as setting up email accounts with their ’secureserver.net’ mail server, if you should need further assistance.
Hope this helps.
-Peter
7:06 am on April 11th, 2007 -
Peter I have the same problem, can you tell me how and what you add/chaged in the CNAME to make this work. I also use godaddy.
Frank
4:09 pm on March 30th, 2007 -
Hi @Stale,
11:44 pm on March 29th, 2007 -
Me again, and I’ve figured out my problem: My ISP blocks outgoing connections to SMTP (port 25) which means I simply can’t host a mailserver unless I use a mail redirect function (such as the one found on http://www.no-ip.com ) to a non-standard port that my ISP doesn’t block. This costs money. Money that I don’t want to spend. So, for everyone out there that’s having problems, try telneting a mail server, and if you can’t connect, you can’t run a mail server. Details of how to telnet can be found on google – it’s easy.
If you registered your domain through godaddy.com, they give you one free email addy – you just have to set it as a catch-all, and you can list everything (ie. admin@domain.com, webmaster@domain.com, etc.) and have it come to you. That’s what I ended up doing.
Hope I can save someone the hours of crap I went through.
-Peter
http://www.igowoof.com
8:40 am on March 24th, 2007 -
Hey, nice work. I own http://www.igowoof.com and am hosting it from my computer w/apache. I’ve figured out mysql and php and all that, but I’ve yet to get an email server running. I followed the install instructions to a ‘t’
Perhaps I have to route the mail function (from my dns provider (godaddy.com) to my ip?)
I’ll try that, and wait for it all to propagate.
If you know something that I don’t, shoot me over an email!
Thanks,
-Stale
10:22 am on March 9th, 2007 -
Hi RageX,
6:49 am on March 9th, 2007 -
I did everything you said for DNS and such but thing is im using a free dns ragex.ath.cx and my isp block port 80
So my webserver run on :81.
My server box for test in lan is 192.168.0.102 ( yes behind a router )
Now in my router i forwarded the following.
Virtual Server DNS 192.168.0.102 UDP 53/53 always
Virtual Server SMTP 192.168.0.102 TCP 25/25 always
Virtual Server POP3 192.168.0.102 TCP 110/110 always
Even by putting announce myself as ragex.ath.cx or http://www.ragex.ath.cx or ragex.ath.cx:81 won’t work.
Cannot resolve Gmail.com
The reason why i setup this is for Outgoing mail’s to work for example i install a Test CMS and require validation by mail i want the mail to reach the user inbox.
Any suggestion? if for example Mercury Mail wasn’t the best suggestion for this and i could use another programs to bind with an existing email adresse of mine .
Anyway if you can help me on this would be appreciated.
4:49 am on March 7th, 2007 -
nice article…….but…………
dont u think u have forgotten itz…… security part….
that’s how to stop spammers to use open relay…….
as any one following u r article will lead to serious security probs…………
better consider it …….ASAP……
1:08 am on June 3rd, 2006 -
Well said.