zimcoder Level: VB Lord

 Registered: 27-10-2003 Posts: 225
|
Re: Mail Page in Asp.net ?
Sending email in asp.net is very simple and straight forward.
The first thing to do is to import the approriate namespace for using email
Imports System.Web.Mail
then create an instance of the MailMessage class from the above namespace
Dim Msg as New MailMessage
with this newly created message.. you can prepare your mail
Msg.To = "therecepient@theiraddress.com"
Msg.From = "yourname@sevriceaddress.com"
'To CC this email
Msg.Cc = "copiedto@theiraddress.com"
'To BCC
Msg.Bcc = "blindone@thosewhorblindaddress.com"
'Now you decide the format and Send the email in format
Msg.BodyFormat = MailFormat.Html
'Set the priority - options are High, Low, and Normal
Msg.Priority = MailPriority.Normal
'Set the subject
Msg.Subject = "ASP.NET email"
'The body of the email
Msg.Body="This email has been sent from an asp.net page and is in html format!"
'now to send the email specify the smtp server
SmtpMail.Server ="mail.someaddress.com"
SmailMail.Send(Msg) |
To send to a multiple of email addresses, write a function that will return a string with email addresses separated by commas after looping through a collection. this string can be used as input for Msg.To or Msg.CC or Msg.Bcc
____________________________
BrainBench ADO.NET and ASP.NET Certified Developer
 
|