jump to navigation

M10MAIL Server, my longer and not yet finished project April 4, 2009

Posted by Dante in M10MAIL, c#.
Tags: ,
trackback

The electronic mail has always been the argument I prefer from the point of view of the programming. In a mail server there are a lot of stuff to learn and many of  these are amazing. I developed this project like an hobby, not for my job, since 2005 using c#, reading documentation about the protocols and searching all the helpfull tips pubblish on the web.

Protocols used to send, read and store emails are:

  • SMTP, simple mail transfer protocol defined in the RFC 2821
  • POP3, post office protocol defined in the  RFC 1939 
  • IMAP4, internet access message protocol defined in the RFC 3501 

Discover that behind a mail server there are three  protocols coded was the incentive for me to start this project.

To develop M10MAIL Server I’ve used: Visual Studio, C# and SQLite.

The components running are:

  • M10mailserver, like a windows service starts at the windows startup. This component call and check the runing of the other components.
  • M10smtp, the SMPT Server listen on tcp port 25 (or other tcp port)  for incoming connection.
  • M10router, the SMTP client that deliver the email to the final destination.
  • M10pop3, the POP3 server listen on tcp port 110 (or other tcp port).
  • M10imap4, the imap4 server listen on tcp port 143 (or other tcp port).

 The first componet to develope is M10mailserver, using Microsoft Visual Studio and start a new solution, then add a new project choosing in the “projects template windows” the “windows service template” that prepare for you the class to build a “windows service” and appear in this way:

public partial class M10MailServer : ServiceBase
{
public M10MailServer()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
}
protected override void OnStop()
{
}
} 

Rename the solution and the project “M10MailServer” and rename the class name in the “windows service” project in M10MailServer. Now, the template addes for you two methods, “onStart” and “OnStop” but you need other methods to use your “windows service” .

Add this lines to your project:


static void Main()

{

System.ServiceProcess.ServiceBase[] ServicesToRun;

SevicesToRun = new System.ServiceProcess.ServiceBase[] { new M10ailServer() };

System.ServiceProcess.ServiceBase.Run(ServicesToRun);

}

Now we are ready to add the statements in the “OnStart” method  to tell to “m10mailserver” what must be done !

Comments»

No comments yet — be the first.