I'm Keyvan Nayyeri, a 25 years old Ph.D. student at
the Computer Science department of
the University of Texas at San Antonio.
I'm also
a Software Architect and Developer and previously held a B.Sc.
degree in Applied Mathematics.
This is my blog where I publish content about various topics specifically Programming Languages and Compilers, Software
Engineering and Programming.
I share another component for .NET 2.0: Gopi (Gopi is the name of one of our old cats).
Gopi is a SMTP component for .NET 2.0. I’ve written it based on .NET 2.0 new features in C#. Probably you know that ASP.NET 2.0 has default features to configure your SMTP server for credentials but still you have to write your own storage system. Gopi does this for you.
Gopi uses a SQL provider to save all emails in database and sends them from database when you want. Gopi has a base provider for storage system and you can implement base class. I didn't implement .NET 2.0 provider base class because it wasn't necessary in my mind. This is Gopi's simple structure:

.NET has left previous objects for emails and SMTP servers and they are obsolete now. If you want to know how you should send emails via SMTP servers with credentials in a nutshell, take a look at this part of my code:
private bool SendMail(MailMessage Email)
{
try
{
SmtpClient objSmtp = new SmtpClient(this._SMTPServer);
objSmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
if (this._Username != null && this._Password != null)
{
NetworkCredential objCredential = new NetworkCredential(this._Username, this._Password);
objSmtp.UseDefaultCredentials = false;
objSmtp.Credentials = objCredential;
}
if (this._Port != -1)
objSmtp.Port = this._Port;
if (this._TimeOut != -1)
objSmtp.Timeout = this._TimeOut;
objSmtp.Send(Email);
return true;
}// try
catch
{
return false;
}// catch
}// SendMail
Gopi is available with full source code and SQL script (Table and Stored Procedures) here.
Sidenote: I’ll be happy, if you develop my components and Add-ons and let me know your ideas and suggestions. If you modified my components and codes, it’s worth to share it with me and others. I’ll publish any modifications to my codes on my file gallery.
Keyvan Nayyeri
Sep 01, 2006 11:15 AM
#
chewytest2
Dec 24, 2006 4:21 AM
#
Leave a Comment