View Single Post
  #4 (permalink)  
Old 09-22-2007, 02:06 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Wink Re: How to send HTML Emails?

Use the following code buddy..
Code:
Imports System.Web.Mail
'namespace to be imported

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Button1.Click
Dim mailMessage As New MailMessage()
'creating an instance of the MailMessage class
mailMessage.From = "test@test.com"
'senders email address
mailMessage.To = "demo@mytest.com;test@base.com;abc@abc.com"
'multiple recipient's 
mailMessage.Cc = "nama@mycom.com"
'email address of the Cc recipient 
mailMessage.Bcc = "bccCopy@test.com"
'email address of the Bcc recipient 
mailMessage.Subject = "Hello"
'subject of the email message
mailMessage.BodyFormat = MailFormat.HTML
'HTML message format 
mailMessage.Body = "<html><body><b><u>" & "This tutorial is sending an HTML email_
with an ASP.NET app." & "</u></b></body></html>"
'message body, html message
Dim Attach As MailAttachment = New MailAttachment("C:\images\sun.gif")
mailMessage.Attachments.Add(Attach)
'adding an attachment
mailMessage.Priority = MailPriority.Normal
'email priority. Can be low, normal or high
SmtpMail.SmtpServer = "mail.yourserver.com"
'mail server used to send this email. modify this line based on your mail server
SmtpMail.Send(mailMessage)
'using the static method "Send" of the SmtpMail class to send the mail
Response.Write("Mail sent")
'message stating the mail is sent
End Sub
Attachment sending also in that coding.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Reply With Quote