Click here to Skip to main content
15,886,578 members
Articles / Programming Languages / C#
Article

SMTP and POP3 Mail Server

Rate me:
Please Sign up or sign in to vote.
4.88/5 (96 votes)
29 Sep 20031 min read 1M   18.9K   315   313
An SMTP and POP3 mail server written using the .NET Framework and C#.

Sample Image - smtppop3mailserver.jpg

Introduction

The MailServerComponent implements POP3 and SMTP (core) servers. It Handles lowlevel POP3 and SMTP commands and raises events according to it. The MailServer service just handles MailServerComponent events and does mail retrieving and storing job.

Features

General:

  • SMTP/POP3/IMAP4/WebMail
  • IP access filtering
  • User mailbox size limit
  • Supports XML or MSSQL databases
  • Nice GUI for administation
  • Well commented source code included

SMTP:

  • All basic SMTP features  
  • Supports multiple domains  
  • Supports multiple e-address for one mailbox  
  • Supports aliases(Mailing lists). Supports public and private(needs authentication) lists.
  • Supports email routing. eg *ivar* pattern routes all addresses containing ivar to specified mailbox or remote address  
  • SMTP AUTH (LOGIN CRAM-MD5) (supported authentication types)  
  • SMTP SIZE, PIPELINING, 8BITMIME, CHUNCKING support  
  • SMTP custom message filters  
  • Relay can be controlled by IP access or authentication

POP3:

  • All basic POP3 features
  • APOP command for secure authentication
  • POP3 AUTH (LOGIN CRAM-MD5) (supported authentication types)
  • POP3 remote accounts

WebMail (ASP.NET):

  • Standalone webmail, can be used any with IMAP based mailserver
  • Supports XML or MSSQL databases
  • Multiple UI languages (ENG,EST,RUS)

Notes

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Estonia Estonia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRe: Awsome work,... Pin
Ivar Lumi21-May-08 6:56
Ivar Lumi21-May-08 6:56 
GeneralRe: Awsome work,... Pin
Farrukh_521-May-08 21:21
Farrukh_521-May-08 21:21 
General1222 Pin
zebot3-Mar-08 23:31
zebot3-Mar-08 23:31 
GeneralPOP3 password from Pin
Naresh Jakher3-Jan-08 23:29
Naresh Jakher3-Jan-08 23:29 
GeneralSetting up SMTP Server Pin
WRYates9-Nov-07 4:32
WRYates9-Nov-07 4:32 
GeneralRe: Setting up SMTP Server Pin
Ivar Lumi9-Nov-07 5:33
Ivar Lumi9-Nov-07 5:33 
GeneralRe: Setting up SMTP Server Pin
WRYates24-Sep-08 5:02
WRYates24-Sep-08 5:02 
GeneralGetting nulls on attachments in smtp server Pin
tumitoto26-Sep-07 8:17
tumitoto26-Sep-07 8:17 
I got a client sending a message with 2 attachments (2 files) as the example Ivan shown me. I activated the smtp server and got a receive event triggered as follows:

private void aSvr_MessageStoringCompleted(object ax, LumiSoft.Net.SMTP.Server.MessageStoringCompleted_eArgs e)
{
LumiSoft.Net.Mime.Mime aM = new LumiSoft.Net.Mime.Mime();
aM = LumiSoft.Net.Mime.Mime.Parse(e.MessageStream);
LumiSoft.Net.Mime.MimeEntity[] aTTx = aM.Attachments;
}

The MainEntity of aM after the parse mostly are nulls, am I doing something wrong? I sent a mail with 2 file attached as follows in my client code:

Mime m = new Mime();
MimeEntity mainEntity = m.MainEntity;
// Force to create From: header field
mainEntity.From = new AddressList();
mainEntity.From.Add(new MailboxAddress("oing", "oing.u@l-4.com"));
// Force to create To: header field
mainEntity.To = new AddressList();
mainEntity.To.Add(new MailboxAddress("oing u", "oPS@gvlexchrtr.l-43.com"));
mainEntity.Subject = "subject is test";
mainEntity.ContentType = MediaType_enum.Multipart_mixed;
MimeEntity textEntity = mainEntity.ChildEntities.Add();
textEntity.ContentType = MediaType_enum.Text_plain;
textEntity.ContentTransferEncoding = ContentTransferEncoding_enum.QuotedPrintable;
textEntity.DataText = "Message body text.";

MimeEntity attachmentEntity = new MimeEntity();
attachmentEntity.ContentType = MediaType_enum.Application_octet_stream;
attachmentEntity.ContentDisposition = ContentDisposition_enum.Attachment;
attachmentEntity.ContentTransferEncoding = ContentTransferEncoding_enum.Base64;
attachmentEntity.ContentDisposition_FileName = "testatta.xxx";
attachmentEntity.DataFromFile("testatta.xxx");
mainEntity.ChildEntities.Add(attachmentEntity);

attachmentEntity = new MimeEntity();
attachmentEntity.ContentType = MediaType_enum.Application_octet_stream;
attachmentEntity.ContentDisposition = ContentDisposition_enum.Attachment;
attachmentEntity.ContentTransferEncoding = ContentTransferEncoding_enum.Base64;
attachmentEntity.ContentDisposition_FileName = "testatta.txt";
attachmentEntity.DataFromFile("testatta.txt");
mainEntity.ChildEntities.Add(attachmentEntity);

LumiSoft.Net.SMTP.Client.SmtpClientEx.QuickSendSmartHost("localhost", 27, "localhost", m);

This email did ok when I sent it to Exchange server, but when I change it to sent to local smtp server, I got nulls in the MainEntity as described above. Thanks for your assistance in advance.


GeneralRe: Getting nulls on attachments in smtp server Pin
Ivar Lumi26-Sep-07 19:52
Ivar Lumi26-Sep-07 19:52 
GeneralRe: Getting nulls on attachments in smtp server Pin
tumitoto1-Oct-07 3:00
tumitoto1-Oct-07 3:00 
GeneralRe: Getting nulls on attachments in smtp server Pin
tumitoto1-Oct-07 7:56
tumitoto1-Oct-07 7:56 
QuestionEml Attachment Pin
payneau22-Sep-07 6:52
payneau22-Sep-07 6:52 
AnswerRe: Eml Attachment Pin
Ivar Lumi23-Sep-07 6:11
Ivar Lumi23-Sep-07 6:11 
GeneralRe: Eml Attachment Pin
payneau23-Sep-07 8:57
payneau23-Sep-07 8:57 
GeneralRe: Eml Attachment Pin
Ivar Lumi23-Sep-07 10:17
Ivar Lumi23-Sep-07 10:17 
GeneralRe: Eml Attachment Pin
steplife21-Sep-08 23:47
steplife21-Sep-08 23:47 
QuestionHow you do attachement with this? Pin
tumitoto21-Sep-07 3:20
tumitoto21-Sep-07 3:20 
AnswerRe: How you do attachement with this? Pin
Ivar Lumi23-Sep-07 6:18
Ivar Lumi23-Sep-07 6:18 
GeneralRe: How you do attachement with this? Pin
tumitoto25-Sep-07 10:00
tumitoto25-Sep-07 10:00 
GeneralRe: How you do attachement with this? Pin
Ivar Lumi25-Sep-07 19:38
Ivar Lumi25-Sep-07 19:38 
GeneralRe: How you do attachement with this? Pin
tumitoto26-Sep-07 7:39
tumitoto26-Sep-07 7:39 
GeneralCross-Domain Pin
dickinson.jonathan27-Jul-07 6:33
dickinson.jonathan27-Jul-07 6:33 
GeneralRe: Cross-Domain Pin
Ivar Lumi27-Jul-07 8:09
Ivar Lumi27-Jul-07 8:09 
GeneralMail Robot? [modified] Pin
Anthony Baraff25-Jul-07 9:09
Anthony Baraff25-Jul-07 9:09 
GeneralRe: Mail Robot? Pin
Ivar Lumi27-Jul-07 8:04
Ivar Lumi27-Jul-07 8:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.