Malek's Moorish Tales

Meanderings about life and technology

Caught formating and parsing stuff once again ...

   Some time ago, I swore never to format or parse anything anymore ... Well, usually one really doesn't have to, since there are often higher layers for most protocols. However, I have made an even stronger oath never to copy somebody else's code without either going through every detail of it, making it maintainable (comments and structure), and testing it to a fair level of confidence, before using it in a project (off course I'm talking about non copyrighted code).

   Well, I have not had to integrate email in my applications beyond the functionality of System.Web.Mail classes. Until today, when I had to do some authentified smtp mail sending, and some pop3/imap mail retrieval. I must confess I started by looking at some user samples and source code in the regular sites ( , codeproject ...etc), and did find some intersting classes, except that they just did not satisfy my maintainability criteria, and would have taken me more time to arrange than just plain rewriting the code.

   Here I am thus, about a half day later, with a functional smtp client class (that replaces somewhat the smtpMail class of System.Web.Mail, and is able to do authentication using Base64 Encoded username and password, and send a System.Web.Mail.MailMessage object. I have not finished doing the necessary parsing for the pop3 retireved messages (I will have to postpone that until wednesday because of the many engagements I have tomorrow...)

   Attached is the code to my smtpManager Class.

SmtpManager.cs (7.81 KB)

Add comment

  • Comment
  • Preview