SIGN UP MEMBER LOGIN:    
ARTICLE

Sending E-mail using SMTP Service

Posted by Seyed Mostafa Mansourfar Articles | Internet & Web August 21, 2006
This article actually is a mail console which is implemented by C# 2.0 and designed to send a standard mail message to one or more receptions.
Reader Level:
Download Files:
 

"Email" term is one of the most practical words in IT field. There are some classes in .Net which help us construct and build mail messages.

In this application I have used SMTP (Simple Mail Transfer Protocol) service to send messages.

As you see (in figure 1) "E-mail Console" provides some of standard email fields which is familiar for most of you.

Figure 1(Email Console main form)

With this application you can send message to any number of recipients which are delimited by ";" character. For example you can fill the "To address" field like this:

"john_smith@yahoo.com;john.smith@gmail.com;johnsmith@hotmail.com"

Moreover, if any mistake happens in one or more addresses, those addresses will be recorded and will be shown in a list box before sending operation performed.

Actually email addresses are evaluating with a function named "valid_email"which gets an email address and validates it.  Remember that only "_" and "." Characters accepted in addresses.

Finally, I like to focus on "smtpclient" class which exists in "System.Net.Mail" namespace. "smtpclient" class needs some properties be set, based on the application.

In this application I preferred to set the

  • "smtpclient.DeliveryMethod" - Specifies how outgoing email messages will be handled.
  • "SmtpDeliveryMethod.PickupDirectoryFromIis" - which sends message using IIS's Queue.

For, any additional information the source code will be useful. I would also be happy to receive the feedbacks.

Login to add your contents and source code to this article
share this article :
post comment
 

Hi,

I see that you wrote that you used IIS to send email. Does the SmtpClient class require IIS, or could your code be modified to use any smtp server?

Thanks,

Peter

Posted by pccm2468 Aug 25, 2006
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Team Foundation Server Hosting
Become a Sponsor