Author Topic: [Tutorial] Run your own Mail/Radio Server (Beginners Only)  (Read 2160 times)

0 Members and 1 Guest are viewing this topic.

Offline haku Black

  • alchi ko pinda
  • *
  • Posts: 19535
  • Reputation : 10
  • Gender: Male
  • nepali
    • sports unlimited
[Tutorial] Run your own Mail/Radio Server (Beginners Only)
« on: December 16, 2006, 08:15:22 AM »
Audio Streaming Server (Radio)

What is a Streaming Audio Server
Its an application that will allow you to "stream" or send a continuous block of data to a client. In a few words, it will allow you to put your own radio station online, where it will be feed by sound files lying around your hardrive, and then clients will connect to the server, and will have the chance to listen whats being playing, just like a plain old school radio station, only that this one is digital, thus allowing better quality, and management is really simple after you follow some simple steps in the initial configuration.

For this tutorial, we'll use two available solutions, both are very good in the sense they do their job well, so its up to you to decide which one to pick up in the end :D


[size=14]1.1 Winamp[/size]
Required by the broadcasting client to send the music files straight to the server.

[size=10]Download[/size]
Code: [Select]
http://download.nullsoft.com/winamp/client/winamp5094_full_hawthorne_emusic-7plus.exe


[size=14]1.2 SHOUTcast Server 1.9.5[/size]
This one directly from Nullsoft, the creators of winamp.

[size=10]Download[/size]
Code: [Select]
http://www.shoutcast.com/downloads/sc1-9-5/shoutcast-1-9-5-windows.exe
[size=10]Installation[/size]
This is very simple. All you have to do is follow the "advanced" windows approach, aka "next->next->next"
Once you're done, you'll have a folder C:\Program Files\SHOUTcast which is the default, and the one Ill be refering to in the rest of this tutorial.

[size=10]Configuration[/size]
Now we're off to configure the server to make it run smoothly. Follow the newly created shortcuts in the start menu (folder SHOUTcast DNAS), and run the server configuration utility SHOUTcast DNAS (GUI)
You should get an image like this one



Ok, now you we're off to explain the menues

Kill Server: Self-explanatory :D. It kills the serve, and all active client connections. So use it when you just want to shut it down for a while. Notice also that when you run the application, a little icon is displayed in the system tray.

Hide Monitor: Will basically minimize the window. The only way to get it back is via the aforementioned icon in the system tray. You can also access this function from the "X" button of the window.
Edit Log: Will simply give you access to the log file of the server, where useful information such as startup time, clients connection and so on are displayed. You can save the file to your hardrive, for historical purposes or whatever suits your needs.
Edit Config: This is the most important part, and the one Ill focus here, since it gives you access to all the configuration parameters of the server.



As you can see, you need to restart the server if any changes were made in order to the server to reload the new values. Notice if it opens notepad by default, probably the end-line characters wont be parsed correctly, which in plain english means you'll see sort of gibberish. So, close the server, and go straight to C:\Program Files\SHOUTcast and open the file sc_serv.ini with another text editor, such as wordpad, which recognizes unix end-line characters correctly.

Now I'll explain the most important options, change them accordingly to suit your needs, or leave the default if you're still confused about any. Notice the developers of this great application made a good job, and they explained the options very well in the ini file, however, if you still are a little lost, follow my prior advice.
  • MaxUser :? This is the maximum allowed number of simultaneous listeners. This is, the max number of users that can be connected at the same time to your server. This one is a little tricky as it depends on your connection speed, so you might want to customize this to suit your needs.
    In the docs, there is a function to calculate this:
    Code: [Select]
    MaxUser = [Upstream speed of your connection] * 0.9 / [Desired bitrate]
    So lets suppose your upstream connection (the speed you can upload at) is 350, and the bitrate you want to serve your mp3's at is 32 kbps:
    Code: [Select]
    350 * 0.9 / 32 ~= 10 users
    But be aware you can play around with this number, and you can even try to set it higher, but then you'll need a bunch of beta testers that might want to connect to your server and then report you how well it did, if they had connection problems, if the sound had glitches, etc...
    So if you're not sure, set it to the number of users given by the above function (or even less).
  • Password :? This is the admin/broadcast password, that you will use to administer the server via a web-interface (more of this later) and to send the broadcast via the DSP plugin (next section..).As usual, enter a hard to break password, likely containing letters, numbers, punctuation characters and caps.
    Notice there is an option to use this password as the one for broadcasters, and use another one for administration (separately that is), but for the sake of ease, lets just use this one for both functions.
    Code: [Select]
    Default:
    Password=changeme
    Example:
    Password=YoU.W0nt.Bre4k.ME.587
  • Portbase : Simply the port where your server will listen for client requests, aka the little door in your PC that clients will try to connect to (or open). Default value is recomended.
  • AutoDumpUsers : Simply put, if you shut down the server, why dont you disconnect the clients too?
    Code: [Select]
    Default:
    AutoDumpUsers=0
    Recomended
    AutoDumpUsers=1
We're done with the configuration. Piece of cake, eh? :D . Save the changes and close the file.


[size=14]1.3 SHOUTcast DSP 1.8.2[/size]
This one directly also from Nullsoft. This is a Winamp Plugin that will allow you to send the real broadcast to the server you just configured, aka it will stream the mp3 so that it can be listened to.

Download
Code: [Select]
http://www.shoutcast.com/downloads/shoutcast-dsp-1-8-2b-windows.exe

Installation
Close Winamp if its opened. Then, again, follow the "next->next->next" approach... :D

Once you're done, you'll want to check out if the plugin was installed correctly, and get ready for the next step.
Simply open Winamp, then hit Ctrl+P to open the preferences window:



Now close the preferences window, and the DSP dialog should be shown by now (and everytime you start Winamp).
At this point we have to configure the DSP plugin to start the broadcast.

Configuration
Now we'll take a look at the different tabs, and what we should fill in the different fields of these

  • Main Tab: Its the worthless of them all. Basically it will show you the status of the different Outputs and the DeciBels.



  • Output Tab: This is the most important of them all. Screw something here and you wont have your server streaming any sound :D



    Lets go easy on this one.
    The output part will show you which one of the 5 outputs are you configuring. What this means is that you can have your DSP plugin stream sounds to 5 different servers, thats all. For ease purposes, lets just leave it selected in the output #1 and forget about the others.
    The status part will show more or less the same stuff that in the Main Tab. But whats important is the button connect. You are supossed to push it once all this configuration is done, to start broadcasting the sound right to your server. (Final step).

    Now lets head over the Output Configuration part.
    In the address field just write the IP or domain name for your server (the server you will be broadcasting to, that is). Notice that if your server is at the same computer where you will be using the winamp+DSP plugin, then you can just put localhost and thats it.
    In the port field, put the Portbase value you configured for your server above, in the former section...
    In the password field, put the Password value you configured for your server above, in the former section...
    From the encoder list, just pick up 1, since basically you will be able to make 5 different configurations for 5 different outputs (remember?), so, since we'll be using just output, then we just configure 1 encoder, and this is the one we select here (more on encoders later)
    Push the checkbox Enable Reconnection on Reconnection Failure, that means if there is a problem with your server, then the DSP plugin will try infinitely to reconnect until its up again

    Now lets head over the Yellow Pages Configuration part.
    The checkbox Make this server public (Recommended) basically will allow your server to be listed in www.shoutcast.com listings. Wheter you want to do this or not (you want to keep this private) its your call. Two things you need to have in account. First, your shoucast server needs to have a domain; if it has an IP, then you wont be listed there. And second, from the instant you begin the broadcast by pressing the button mentioned above, it will take from 10 to 15 minutes for your server to be listed there. Once its listed, it will look like this (I made a search for Billy Boy and thus I got my server among the results)



    So as you can see, anyone going to www.shoutcast.com could find out about my server, and tune it. If you want to keep it private, then just dont click the checkbox, thats all.
    In the Description field... well, just put your server description, to be shown in shoutcast listing as shown above, and this is also what your listeners will see in the music player playlist.
    The URL field is usually an address where people who got to your server through the shoutcast listings, can find more information. This should be sort of your website or the radio's website. You get the picture. But please notice this URL has nothing to do with the Address field we went through before, they can be the same, but dont have to...
    Now the Genre field is self-explanatory...
    And finally the fields AIM, ICQ and IRC are just contact addresses, pretty much like URL so you know what to (or what not to) put in here... :D

  • Encoder Tab: This one is simple. As explained before, choose the Encoder 1 item in the list, and select the appropiate Encoder Settings, aka the bitrate we even made a math formula above, remember?
    In the Encoder Type field just leave the default value...



  • Input Tab: This part will tell your Winamp what to broadcast, your MP3s (Winamp (Recommended)) that winamp is playing right now or...
    Quote from: Little Joe
    Mom, I wanna be a real DJ
    Ok, sometimes, you'll want to broadcast your ugly voice :twisted: to your listeners (poor them)... How do you do that? Simple. You select Soundcard Input as your Input Device, change the Input Settings to what you consider and then pull out that dusty microphone and start speaking...
    One tip here, you can dynamically change between Winamp (Recommended) and Soundcard Input as much as you want, and play to be like a real DJ in a radio station. Notice that when you change from Soundcard Input to Winamp (Recommended), if you take, lets say 10 seconds to hit the play button in winamp (to start playing a song), these 10 secs wont be streamed to your listeners, so you have time to speak, something among the lines "Now enjoy SongX", change the Input Device to Winamp (Recommended), search for the song in the playlist (or load it), then hit the play button. Your listeners will only listen to the "Now enjoy SongX" and right away the song, no interruptions in the middle. Rather cool, eh?
Now you're done. Hit the connect button in the Output Tab and you'll be broadcasting to your shoutcast server right away.

Administration
You can now administer your shoutcast server from a web-based interface.
To access it, just go with your browser to
Code: [Select]
http://yourserver:port
Where yourserver is the value configured in the field address of the Output Tab in the DSP plugin, and port is the Portbase value you configured for your server
In the example we have been following along, its would be
Code: [Select]
http://www.billyboy.com:8000/

You'll be looking at something like this



  • Status: The "welcome" screen you see in the image...
  • Song History: Well... the list of streamed songs since the server was started
  • Listen: Basically, the link you have to give your listeners so they will be able to connect to the server and start listening (doh!). If you are not very good with the html, copy & paste this code inside a HTML page (maybe the one pointed by URL in Yellow Pages? :roll:)
    Code: [Select]
    <a href="http://www.billyboy.com:8000/listen.pls"><img src="tunein.gif" width="49" height="15" border="0"></a>
    And replace the href tag to what the link in Listen points to.
    Here is the classic "tune in" image




  • Stream URL: Basically, the URL in Yellow Pages (DSP configuration dialog if I lost you here)
  • Admin Login: This is where you play to be an admin. I will only tell you, to login you need a login/password combo. The login is just admin, and the password is the Password variable in the shoutcast configuration file (sc_serv.ini).
    As I explained above, you could have a unique password for admin functions, if you fill in the field AdminPassword in the aforementioned ini file. (Just take away the ; (semicolon) and put the password you want.
    If you enter a password there (in AdminPassword), then this is the one you will use here, otherwise just use the mentioned one (Password). If you're lost here, then nevermind and just forget what I said in the last 2 paragraphs (including this one) :D
    Since I hate to be a party boomer, Ill let you enjoy the fun and test all of the options in the admin page by yourself.
    Consider this a teaser



Testing
Ok, so you have your server up and running, but now you need to somehow test it, to check out if everything is working as expected, right?
If you dont have two computers to test it, and knowing the fact that winamp wont allow two instances of itself to be running at the same time, what would you do?? :roll:
So dont fear. There are a number of media players that support shoutcast streams, and we will look at one of them.
The name's XMPlay, and its a very lightweight media player, that can be freely downloaded from here
Code: [Select]
http://www.un4seen.com/files/xmplay32.zip
Now lets see what might be the URL your users will need in order to connect to your server. I explained in the subsection above how to get this URL by means of the admin panel, but if you want to know how do you get int manually, here it is
Code: [Select]
http://yourserver:port/listen.pls
Where yourserver is the value configured in the field address of the Output Tab in the DSP plugin, and port is the Portbase value you configured for your server.
In our now old and rusty example, it is
Code: [Select]
http://www.billyboy.com:8000/listen.pls

Then fire up XMPlay, press the key O (keyboard shortcut to open files/URL) and fill the appropiate value



Now you shoould be listening to your radio server!



Just FYI, in Winamp you open an URL with Ctrl+L.



2.1 Winamp
Refer to Section 1.1

2.2 Icecast 2.2.0
This one directly from the creators of the ogg sound format, among other open source niceties.

Download
Code: [Select]
http://downloads.us.xiph.org/releases/icecast/icecast2_win32_2.2.0_setup.exe

Installation
This is far easy. Just follow the "next, next, next" approach and you're done with it.

Configuration
So, we're all set to start configuring the server. Run it by using the shortcut in the desktop (Icecast2 Win32), and then you'll be introduced to the following screen



There is no much to explain about the GUI, so Ill just tell you the help is located in the About menu :D
Before I start spitting my gibberish here, lemme explain, that the configuration is done by changing/adding values to an XML file, namely icecast.xml in C:\Program Files\Icecast2 Win32 (if you installed icecast in the standard path). So, if you're familiar with XML, then you have a slight advantage on your side. However, if you dont know XML or dont even know what it is, no problem, the configuration procedure is still piece of cake (seems like everything in this tutorial is :lol:)
But I know there are some folks out there who like to learn something new, so the beginner point by excellence to learn XML is this one
Code: [Select]
http://www.w3schools.com/xml/default.asp

Ok, now lets continue. Head over to the Configuration menu, and select the only available item in there (Edit Configuration). You should see the configuration file right now, opened in notepad.
BTW, while you're editing the file, you cant start the server, since the main window freezes. This is normal, and its made for security purposes (although you can simply go to the installation folder, and open the .xml file... :D)
Now you can safely select all the text (ctrl+a) and then delete it. Then just copy & paste all of the code below
Quote
<icecast>

? ? <limits>
? ? ? ? <!-- Total number of concurrent connections (not only refering to clients!) -->
? ? ? ? <clients>20</clients>
? ? ? ? <!-- Total number of sources supported. Since we'll be using only the shoutcast plugin in this example, 1 oughta suffice -->
? ? ? ? <sources>1</sources>
? ? ? ? <!-- Number of seconds without response from a source, before it gets disconnected from the server -->
? ? ? ? <source-timeout>10</source-timeout>
? ? </limits>
? ?
? ? <authentication>
? ? ? ? <!-- Password used by the source (shoutcast in this example) to connect to the server -->
? ? ? ? <source-password>YouCantBreakMe</source-password>
? ? ? ? <!-- The username for the administration functions (used with admin-password) -->
? ? ? ? <admin-user>admin</admin-user>
? ? ? ? <!-- The password for the administration functions (used with admin-user) -->
? ? ? ? <admin-password>IBeAdminYouBeNot</admin-password>
? ? </authentication>? ?
? ?
? ? <!-- Yellow page settings. You dont need to change anything here for now. -->
? ? <directory>
? ? ? ? <yp-url-timeout>15</yp-url-timeout>
? ? ? ? <yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
? ? </directory>
? ?
? ? <!-- The name of your host, used by the admin panel and your sources, you can set this to localhost if you know what it implies -->
? ? <hostname>www.billyboy.com</hostname>
? ? <!-- The port your sources will use to connect to your server, and the one you'll use to connect to the admin web interface -->
? ? <listen-socket>
? ? ? ? <port>8000</port>
? ? </listen-socket>
? ? <!-- A miscelaneous setting used to add compatibility with shoutcast (we'll be using it as the source in this tutorial) -->
? ? <listen-socket>
? ? ? ? <port>8001</port>
? ? ? ? <shoutcast-compat>1</shoutcast-compat>
? ? </listen-socket>? ?
? ?
? ? <paths>
? ? ? ? <!-- Where the log files will be stored (relative to the host root) -->
? ? ? ? <logdir>./logs</logdir>
? ? ? ? <!-- Where the admin web-based interface can be accessed (relative to the host root)? -->
? ? ? ? <adminroot>./admin</adminroot>
? ? </paths>
? ?
? ? <logging>
? ? ? ? <!-- Where all the accesses(requests) will be stored (relative to the logdir) -->
? ? ? ? <accesslog>access.log</accesslog>
? ? ? ? <!-- Where all the server errors(duh!) will be stored (relative to the logdir) -->
? ? ? ? <errorlog>error.log</errorlog>
? ? ? ? <!-- Level of the messages logged by the server: 4 Debug, 3 Info, 2 Warn, 1 Error -->
? ? ?    <loglevel>3</loglevel>
? ? </logging>
? ?
</icecast>
The lines in bold are purely so for formatting purposes. They are XML comments that I made, in order to help you change whats required. This is pretty much straightforward, not a lot to explain here. If you need further help, go to About->Help menu in the icecast main window, for a more detailed explanation on every single variable available.

Now spank that Start Server button to run the server.

2.3 SHOUTcast DSP 1.8.2
Refer to Section 1.3 of this tutorial, for installation and configuration options, they are pretty much the same. Just a few things change.

Configuration
To make things short, here is a screenie showing what the Configuration tab should look, if we take in mind the example icecast.xml configuration above.



Notice the password in red is the value of the element <source-password>.
The Yellow pages configuration is pretty much the same. Nothing changes.
So, if everything went ok, you can search for your server once its up and running and Shoutcast DSP broadcasting here
Code: [Select]
http://dir.xiph.org/index.php

In our example, this is how it looks



Administration
You can now administer your icecast server from a web-based interface.
To access it, just go with your browser to
Code: [Select]
http://yourserver:port/admin_path/
Where yourserver is the value configured in the element <hostname> in the icecast.xml file; port is the <port> element in the first <listen-socket> of the sample configuration file above, and admin_path is the value of the element <adminroot>.
Following the example, it would be
Code: [Select]
http://www.billyboy.com:8000/admin/

Now, when you try to access the admin interface, it will ask for a login and password, those are the elements <admin-user> and <admin-password> I talked about in the configuration file (icecast.xml if you're still lost).

The interface is too simplistic and rather ugly, but everything IMHO is really easy to understand, so you're on your own now? :)

Testing
Refer to Testing in Section 1.3.

The URL for your listeners is this one
Code: [Select]
http://yourserver:port/stream
Where yourserver and port values are the same used to access the admin interface (subsection above). So in the example it would be
Code: [Select]
http://www.billyboy.com:8000/stream


Forewords
So, now I have introduced you to 2 of powerfull tools for your internet radio needs. Which one to choose in the end is your call.
If you ask me, Id preffer Icecast, since the docs are way better, and its easier to set up.
Have in mind, I explored here the simple way of broadcasting (i.e by means of the Shoutcast DSP plugin), but in both servers you can also broadcast files without the need of an aditional plugin (aka, no winamp at all), but its more complicated, clumsy (as you dont have the ease of just firing up a playlist and start playing right away, plus the I wanna be DJ -your voice- thingy is also really neat), but you can always check the documentation of both applications more deeply.
I hope you enjoyed this one :wink:



______________________________________________________________________________________________________



Mail 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
This one directly from Pegasus Mail, by David Harris

Download
Code: [Select]
ftp://ftp.usm.maine.edu/pegasus/mercury32/m32-401a.exe
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)
[list=1]
  • 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 :wink:

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 :P- 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.

[size=10]Scenario 1: Dynamic IP Address[/size]
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
So the first two changes look like this



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? :twisted:

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? :twisted:
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


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.

Configuration



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 :twisted:
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)

Code: [Select]
[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
Code: [Select]
<?php

// Simple mail() wrapper 1.0

/* @params
? ? $to_email : Destination mail(s). If several, must be separated with commas
? ? $to_name: Destination name(s). If several, must be separated with commas
? ? $from_email : Sender email
? ? $from_name : Sender name
? ? $subject : ...
? ? $message : The body. Can be plain text or html
? ? $is_html : TRUE is $subject is in HTML code, otherwise FALSE (plain text)
*/
function send_mail($to_email,$to_name,$from_email,$from_name,$subject,$message,$is_html){

$headers="";

if(
$is_html){ 
$headers.="MIME-Version: 1.0\r\n"
$headers.="Content-type: text/html; charset=iso-8859-1\r\n";
}

$headers.="To: ";

$to_email_array=explode(",",$to_email);
$to_name_array=explode(",",$to_name);

foreach (
$to_email_array as $key=>$value){
$headers.="$to_email_array[$key] <$to_name_array[$key]>"
}

$headers.="\r\n";

$headers.="From: $from_name <$from_email>\r\n"

return 
mail($to_email,$subject,$message,$headers);

}

?>


Sample Usage Script (Single destination email and plain text body)

File: use_mail1.php
Code: [Select]
<?php

require_once('mail.php');

$message='You are my idol. No BS intended.'

if(
send_mail("torvalds@osdl.org","Linus Torvalds",
? ? ? ? ? ? ? 
"billgates@billyboy.com","Bill Gates","You rule dude",$message,FALSE))
? echo 
'Mail accepted for delivery';
else
? echo 
'There was an error. Mail not accepted for delivery';
?>



Sample Usage Script (Several Destination emails plus html body)

File: use_mail2.php
Code: [Select]
<?php

require_once('mail.php');

$message='
<html> 
<head> 
<title>What up</title> 
</head> 
<body> 
<p>Im rich. You'
re not</p
</
body
</
html>
'; 

if(send_mail("whoever@whatever.net,anyway@anyhow.org","Little Pete,Joe Doe",
? "billgates@billyboy.com","Bill Gates","You guys rock",$message,TRUE))
? echo '
Mail accepted for delivery';
else
? echo '
There was an errorMail not accepted for delivery';
?>



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.? 8)



______________________________________________________________________________________________________



Obtaining a Domain Name

What is a Domain Name
Computers communicate with each other through an IP address of the form xxx.xxx.xxx.xxx. Since this approach is not practical for us human beings, i.e we cant remember long numbers, then we use what is known as a domain name, which is of the form (and many mutations of this form) www.domainname.xxx where xxx can be org, com, net, etc...
This way, when we use a domain name, in the background a domain name server makes a lookup on that domain name (taking up to n computers) and translates it to an IP.

How do you obtain a domain name?
Simple: buy one. There are some cheap domain sellers, for as little as $5 US / year.
But what if you are poor, or dont have a credit card, bank account, or simply your country is not supported by well known payment methods such as paypal? Well, you can get a domain for the price of a few mouse clicks, which is what Ill cover up in this tutorial.

1.1 No-IP Dynamic DNS System

Website
Code: [Select]
http://no-ip.com/

Head to that website right now. Register a free account, then check your mail for the registration check. Once your account is activated, log in into the website.
Now we are ready to move on

Adding a new Host
Easier this cannot be. Just select Add from the menu at your left, and fill in the field Hostname, then choose the subdomain from the dropbox. Notice not all the subdomains listed are available for free, so just pick up no-ip.org

If you know what you're doing, fill in other required fields (not necesary for any of the server explained in these thread); otherwise head to the button of the page and press the button Create Host



Now you should see a success message (or error in case the domain name written is already registered, in which case, you'll need to pick up another one)



You can try this exact procedure to register up to five domain names, to have something like


billyboy.no-ip.org
ftp-billyboy.no-ip.org
mail-billyboy.no-ip.org
radio-billyboy.no-ip.org
irc-billyboy.no-ip.org


One last thing to notice here, is that, if no-ip.com doesnt recognize your IP correctly, either in the Current IP field in the upper navigation bar, or in the field IP Address in the Add a Host configuration, it doesnt matter at all. You will see why in the next section.

However, if you dont have a dynamic IP (i.e your IP never changes - static IP), then you must fill in the correct IP if not detected automatically, and thats it, you're done for good, and you can skip the next section. You wont need it.


1.2 No-IP Dynamic Update Client (DUC) 2.2.1

Download
Code: [Select]
http://www.no-ip.com/client/ducsetup.exe

Installation
Just follow the "next, next, next" approach. Choose the -enabled by default- option to run the application after the installation.
When you're done, you will be asked to login with the details of the account you already registered in the website...



Configuration
Now you should be presented with a screen where you can see all of your hosts, and all of them are unchecked by default. By enabling the checkboxes you are updating your IP, so that your registered domain(s) point to a valid IP.
What this means is that everytime you connect to the internet, your ISP will assign you a different IP, and this change needs to be reflected in no-ip.com database. You can do this manually though, but what for if DUC can do it for you as easy as that.



If you press the button options, you can change some interesting parameters, like making DUC run at startup, or make it run as a service, among others. Change any of those if you understand what you're doing, otherwise all you need to know is that, everytime you connect to internet, you need to run DUC to issue the IP changes.
This procedure by the way can take up to 10 minutes, so dont worry if your domain name doesnt work right away after an IP change. Just hold tight a little bit. It takes this long since not all that needs to be done is just change a parameter in their database; they also have to make updates to their DNS servers, and thats what takes some minutes? :)

Win32 Bonus Trick

This is a simple but sometimes handy trick many people dont know.
So far, you understand localhost is the loopback address for every computer. This is, your PC will always know that 127.0.0.1 or localhost refers to itself. Now, lets say you want to change this, so that for example www.billyboy.com would point to 127.0.0.1.
Why would you want to do this? Supose you have a lot of servers configured to use the aforementioned domain name, but ATM you're offline or just dont want to get online. So you need your browser and in general all windows applications, to treat www.billyboy.com as if it was the local PC, without using the name localhost.
How to do it? Simple as hell, really. Just open your hosts file, commonly located at C:\windows\system32\drivers\etc\hosts. Fire up your text editor and open this file.
If you never touched it before, it should look like this

Code: [Select]
# Copyright (c) 1993-1999 M'zoft Corp.
#
# This is a sample HOSTS file used by M'zoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#? ? ? 102.54.94.97? ? ?rhino.acme.com? ? ? ? ? # source server
#? ? ? ?38.25.63.10? ? ?x.acme.com? ? ? ? ? ? ? # x client host

127.0.0.1? ? ? ?localhost

Now all you need to do is add another host to the end

Code: [Select]
# Copyright (c) 1993-1999 M'zoft Corp.
#
# This is a sample HOSTS file used by M'zoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#? ? ? 102.54.94.97? ? ?rhino.acme.com? ? ? ? ? # source server
#? ? ? ?38.25.63.10? ? ?x.acme.com? ? ? ? ? ? ? # x client host

127.0.0.1? ? ? ?localhost
127.0.0.1? ? ? ?www.billyboy.com

Now for example, when you have your mail server running, and you're offline, try to connect to it via smtp

Code: [Select]
telnet www.billyboy.com 25

Voila! Now you should see the smtp welcome screen. That is because now www.billyboy.com is recognized by windows, and in this case, as the IP 127.0.0.1, which is the localhost. This way you dont need any DNS lookup servers to resolve the IP, and thus, you dont need a working internet connection.
Notice you dont need to restart windows for the changes to take effect, just save the file and you're done with it.

Forewords

Offline naughtyboy

  • *
  • Posts: 12683
  • Reputation : 60
  • Gender: Male
Re: [Tutorial] Run your own Mail/Radio Server (Beginners Only)
« Reply #1 on: December 19, 2006, 09:18:02 AM »
Thanx soi bro for information
dEAd  mAn  wAlkiNg

Offline SOAD

  • *
  • Posts: 1238
  • Reputation : 10
  • Gender: Male
Re: [Tutorial] Run your own Mail/Radio Server (Beginners Only)
« Reply #2 on: May 23, 2007, 11:46:06 AM »
helpful post

Offline Kharane

  • *
  • Posts: 18363
  • Reputation : 19
Re: [Tutorial] Run your own Mail/Radio Server (Beginners Only)
« Reply #3 on: October 16, 2007, 03:20:58 PM »
Nice one Really Gud Thankx Too

Offline Fox Kid

  • *
  • Posts: 74
  • Reputation : 3
Re: [Tutorial] Run your own Mail/Radio Server (Beginners Only)
« Reply #4 on: October 10, 2008, 08:36:58 PM »
Wow nice man

Ali fursad ma try garnu parla

 


Host By::Love Nepal Network SMF 2.0.2 | SMF © 2011, Simple Machines Our Privacy Policy & Terms of Use