How to setup your own e-mail server

Various changes to the Windows Operating System, also for the Intranet

Moderator: sjj1805

Post Reply
User avatar
sjj1805
Site Admin
Posts: 1194
Joined: Fri Oct 27, 2006 12:45 am
operating_system: Windows 10 Pro
motherboard: Hewlett Packard 2AF7
system_drive: C
32bit or 64bit: 64 Bit
processor: 2-90 gigahertz Intel Core i5 4460S
ram: 8 GB
video card: NVIDIA GeForce GT 705
sound card: P40D100-4 NVIDIA High Definition Audio
Hard_Drive_Capacity: 8 TB
Location: Birmingham UK
Contact:

How to setup your own e-mail server

Post by sjj1805 » Thu Mar 17, 2011 2:39 pm

Origin: http://www.tech2all.com/2006/03/12/how- ... il-server/

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

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 uninstall, you simply remove the created folder in the installation)

1. Press the button New Installation
2. Since we wont be using support for Software Networks, just press the button No Netware Support
3. Now select the directory where you want to install Mercury (or simply extract the contents, as explained before). Recommended is the standard windows installation path C:\Program Files\Mercury. Press the button OK, accept this directory
4. 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
5. Now it asks you for the directory where it should put the user mailboxes. Just leave it as-is (If you followed the recommended installation path, the it should show C:\Program Files\Mercury\MAIL). Press the button Ok, accept this directory
6. 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 every time 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
7. 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…)
8. 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 address 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 don't have a domain name. In the postmaster field, you can leave "Admin"; which is the default, if you want to.
Image

Now press the button OK, continue installation, and we are ready to move on
9. 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
10. 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
11. We are set. This is -at last - the final step. So go ahead and press that button Install Mercury/32 to stop the suffering
12. 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 comfortably, and you should have your server up and running in no time from this point.

So, run the server, which should have a sub menu 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 centre 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.
Image
So, the next part if to create user accounts. Lets create one for this example. Go to Configuration-"Manage local user", then press the button Add, and enter the details as required, like in the picture
Image
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
Image
Now do the same for Configuration-"Mercury SMTP Server"; i.e fill the field IP interface to use
Image
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 assignation 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 every time 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
Image
Image
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
Image
Now go to the tab Local Domains, select the second item, press the button Change entry, and enter the new value
Image
That's it. This needs to be done every single time you connect to the internet. Painful 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 wouldn't make much sense isn't it? So, go ahead and type that in your browser URL bar. What show up in the screen? That's right, our beloved google. Which means that IP address is google address, and http://www.google.com is simply Google's domain name.
Again, if you don't 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 http://www.billyboy.com

Step 8: Put your own domain name in the adequate field
So the first two changes look like this
Image

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"
Image
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.
Image
That's it. Basically, your account properties should look like that, in the case you’re using a domain name, otherwise just fill in the IP
Image
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 Twisted Evil
Just FYI, I'm 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 = http://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.

That's 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 Ruhani Rabin, public domain licensed so do whatever you want with it.
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.
There's obviously more to learn (a lot!) but that's 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 successful mail server Admin someday.

Post Reply