C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Sending Email with ASP.NET 2.0


Posted Date: 03 Sep 2007    Resource Type: Articles    Category: Web Applications

Posted By: Kamal       Member Level: Gold
Rating:     Points: 12



In ASP.Net 2.0 use System.Net.Mail class.

System.Net.Mail is the namespace used to send email if you are using the 2.0 (or higher) .NET Framework.

Unlike System.Web.Mail, which was introduced in the 1.0 Framework, it is not built upon the CDO/CDOSYS libraries. Instead it is written from the ground up without any interop. Thus, it is not dependant upon other COM libraries. System.Net.Mail introduces brand new classes for creating and sending email.

Although some functionality has been removed, the new System.Net.Mail namespace is much more versatile than the older CDO dependant System.Web.Mail.

Dim message As MailMessage = New MailMessage()
message.From = New MailAddress("from@server.com", "From Name")

message.ReplyTo = New MailAddress("reply@server.com", "ReplyTo Name")

message.To.Add(New MailAddress("to1@server.com", "Name One"))
message.To.Add(New MailAddress("to2@server.com", "Name Two"))
message.CC.Add(New MailAddress("cc@server.com", "CC Name"))
message.Bcc.Add(New MailAddress("bcc@server.com", "BCC Name"))

message.Subject = "Subject"
message.Body = "This is a plain text"
message.IsBodyHtml = False

'Priority property can have next values: Low, Normal and High.
message.Priority = MailPriority.Normal

Dim emailClient As New SmtpClient("mail.server.com")
emailClient.Send(message)




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Add dynamic controls with events
Previous Resource: Connection Pooling in ASP.NET
Return to Discussion Resource Index
Post New Resource
Category: Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use