Click here to Skip to main content
Click here to Skip to main content

Pop3 Client Service Engine instead of SQLMail

, 10 Nov 2005
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.

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

mail_readmail 
@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.

History

  • 11th November, 2005: Initial post

License

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

Share

About the Author

Sigura
Web Developer
Russian Federation Russian Federation
No Biography provided

Comments and Discussions

 
GeneralProgram Execution. Pinmemberjrizvi8-Dec-05 18:32 
GeneralRe: Program Execution. PinmemberSigura3-Jan-06 7:56 
QuestionHow about translation to english?... PinmemberBlackTigerAP12-Nov-05 11:51 
AnswerRe: How about translation to english?... PinmemberBlackTigerAP12-Nov-05 12:27 
GeneralRe: How about translation to english?... PinmemberSigura13-Nov-05 22:05 
GeneralRe: How about translation to english?... PinmemberBlackTigerAP14-Nov-05 8:58 
GeneralRe: How about translation to english?... PinmemberSigura15-Nov-05 6:09 
GeneralRe: How about translation to english?... PinmemberSigura13-Nov-05 22:11 

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

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

| Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 11 Nov 2005
Article Copyright 2005 by Sigura
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid