Click here to Skip to main content
12,891,562 members (48,871 online)
Click here to Skip to main content
Add your own
alternative version


28 bookmarked
Posted 10 Nov 2005

Pop3 Client Service Engine instead of SQLMail

, 10 Nov 2005 CPOL
Rate this:
Please Sign up or sign in to vote.
Pop3 Client Service (instead of SQLMail): Pop3 Class + DB Halper Class + Read XML Class + SQL Connection Dlg Control + BLOB to File Util
In Russian

The Prelude

I'm responsible for administering Microsoft SQL Server in our company. Some parts of our system were unstable, i.e., every morning I began with fixing SQLMail (+Outlook) because messaging between services and part of workflow were based on this service. I think many of you experience difficulties with this service. Here are errors which I was getting:

  • xp_readmail: Failed with operating system error 32 [SQLSTATE 42000]
  • xp_findnextmsg: Failed with mail error 0x80040108 [SQLSTATE 42000])

Obviously, for majority of users ???? e-mail sending is enough, but for me it wasn't so, using XPSMTP didn't solve all problems. I was seriously in need of a simple POP3 client. After long and unsuccessful searches for a suitable application, I came to writing this piece of software by myself. So this work is published here with all sources included.

Why Is It Open Source?

I don't think that I've written something outstanding and complete. And if someone will find a bug or a piece of code that can be improved (every software contains lots of them) and will send me a diff with changes, I would be very thankful to that person. Version control is handled by TortoiseCVS.

Why C#.NET was Used for Development?

If you want my opinion, it is convenient for programming under Windows and Windows Server, especially for server applications. You will need Microsoft .NET Framework 1.1. or you can work with POP3 Client Service. The prototype of set of classes for work with POP3 was taken from The Code Project, A POP3 Client in C# .NET. But, after coming across lack of some features, I've significantly rewritten it.

Installation Process

  1. Installing service (start Setup.Exe and finish by pressing the "Finish" button)
  2. Find %WINDOWS%/system32/BC_POP3Client.xml, and edit it for your needs, basically required only to edit
    • Account – which you will use to fetch mail
    • sqlConnection – where you want it stored
    • AttachFolder – where attachments will be stored
  3. Install DBObjectCreate.SQL (where sqlConnection is pointing)
  4. Don't forget to setup service in Start>Settings>Control Panel>Administration>Services>BC_POP3Client>Login (by default, it is started under system account and doesn't have access to the network)
  5. There, you can also start it. That is all. Enjoy.

Now About Work of Service

For you as the end user, the most important tables are mail and mail_attchment: they store information about messages.

Stored procedures were written to be similar to SQLMail.

@msg_id INT, output gives id of unread message ([mail].[isRead] = false) 

@msg_id INT - which message to read 
@attachments VARCHAR (1024), output – list of attachments 
@originator_address VARCHAR (1024), output – senders address 
@originator VARCHAR (1024), output – senders name 
@date_received datetime, output – received date 
@subject VARCHAR (1024), output – message subject 
@recipients VARCHAR (1024), output - recipients 
@message VARCHAR (8000), output – message body 

The set of parameters match procedures of SQLMail because I wanted to make implementing my solution straightforward - make procedure dump, change calls and everything works.

P.S.: Feel free to contact me if some problems arise. We will try to solve them together.


  • 11th November, 2005: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
Russian Federation Russian Federation
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralProgram Execution. Pin
jrizvi8-Dec-05 18:32
memberjrizvi8-Dec-05 18:32 
GeneralRe: Program Execution. Pin
Sigura3-Jan-06 7:56
memberSigura3-Jan-06 7:56 
QuestionHow about translation to english?... Pin
BlackTigerAP12-Nov-05 11:51
memberBlackTigerAP12-Nov-05 11:51 
AnswerRe: How about translation to english?... Pin
BlackTigerAP12-Nov-05 12:27
memberBlackTigerAP12-Nov-05 12:27 
GeneralRe: How about translation to english?... Pin
Sigura13-Nov-05 22:05
memberSigura13-Nov-05 22:05 
GeneralRe: How about translation to english?... Pin
BlackTigerAP14-Nov-05 8:58
memberBlackTigerAP14-Nov-05 8:58 
GeneralRe: How about translation to english?... Pin
Sigura15-Nov-05 6:09
memberSigura15-Nov-05 6:09 
GeneralRe: How about translation to english?... Pin
Sigura13-Nov-05 22:11
memberSigura13-Nov-05 22:11 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170424.1 | Last Updated 11 Nov 2005
Article Copyright 2005 by Sigura
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid