Saturday, July 21, 2007

Thursday, July 19, 2007

Sending email using C# -- CodeResource.net

Code for sending email:
Lets see the code to send an email. This code is executed on the button click control. First of all don't forget to add the
using System.Web.Mail;
namespace which provides the methods and properties for sending an email.
private void Button1_Click(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = txtTo.Text;
mail.From = txtFrom.Text;
mail.Subject = txtSubject.Text;
mail.Body = txtBody.Text;
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(mail);
}
The code you see above is very simple to understand. In the button click event we made the object/instance of the MailMessage class. MailMessage is responsible for sending emails. It also provides several properties and methods. later we assigned several properties.
The line SmtpMail.SmtpServer = "localhost" sets the server for the mail. If you are running the application on your own pc using IIS than your server will be "localhost". If your website is running on the production server you can have different SmtpServer name.
The final line SmtpMail.Send(mail) sends the email to the email address provided.

For complete article: http://www.codersource.net/csharp_sending_emails.aspx

Monday, July 16, 2007

C# - O'reilly definition

C# is a type-safe, component-based, high-performance language that is designed for the Microsoft .NET framework. C# 2.0 is the new generation of C#, upgraded with Generics and other advanced features and fully integrated into .NET 2.0 and Visual Studio 2005. If you are developing Windows or web applications or web services for the .NET platform, C# is in many ways the language of choice.

C# - A whatis.com definition

C# (pronounced "C-sharp") is an object-oriented programming language from Microsoft that aims to combine the computing power of C++ with the programming ease of Visual Basic. C# is based on C++ and contains features similar to those of Java.
C# is designed to work with Microsoft's .NET platform. Microsoft's aim is to facilitate the exchange of information and services over the Web, and to enable developers to build highly portable applications. C# simplifies programming through its use of Extensible Markup Language (XML) and Simple Object Access Protocol (SOAP) which allow access to a programming object or method without requiring the programmer to write additional code for each step. Because programmers can build on existing code, rather than repeatedly duplicating it, C# is expected to make it faster and less expensive to get new products and services to market.
Microsoft is collaborating with ECMA, the international standards body, to create a standard for C#. International Standards Organization (ISO) recognition for C# would encourage other companies to develop their own versions of the language. Companies that are already using C# include Apex Software, Bunka Orient, Component Source, devSoft, FarPoint Technologies, LEAD Technologies, ProtoView, and Seagate Software.