Mail Service with
for IT guys......

The process of Creating and Sendig as E-mail Message

1.Mail message and other mail-related classes are in the System.Net.Mail namespaces

2.Create the mail message object
   Dim m As MailMessage=New MailMessage("","","Mail Subject",Mail Contentss")
3.If you didn't specify the recepients in the MailMessage Constructor,add them to the mail message object
   Dim m As New MailMessage()
   m.From=New MailAddress("","Theva")
   m.To.Add(New MailAddress("","Jeya Anna")
   m.To.Add(New MailAddress("","Tevaganthan")
   m.Subject="This is the Demo"
   m.Body="This is the contents of the mail demo"

4.Blind carbon Copy,Carbon Copy and Attachments.
   Dim m As New MailMessage()
   m.Bcc.Add(New MailAddress(txtbcc.Text.Trim))
   m.CC.Add(New MailAddress(txtcc.Text.Trim))
   m.Attachments.Add(New Attachment(txtattachement.Text))

5.Properties of the mail message objects
  a) Delivery notificationOption:- 
     Instructs the SMTP Server to send message to the address specified in MailMessageFrom if a message is delayed,fails or in successfully deliverd        or relayed on another server.
    The values of the Delevery Notifications are:On success/On Failure/Delayed/Never and None.
  b)Pirority: Mail Priority:- High/Low/Normal
  c)Reply to:-

6. Multipurpose Internet Mail Extensions(MIME)
  This is the content type which is using the Imports System.Net.Mime.MediaTypeNames name space.
  There are special MIME types for Text and Images

7.If you need to provide multiple views(Such as plain Text and HTML),Creat alternative view object and add   them to Mail message object.

Simple Demo for mail service... 

Backend Coding  


Imports System.Net.Mail

#End Region


Public Class Form1

#Region "UI Events"

Private Sub btnsend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsend.Click, Button1.Click


  MessageBox.Show("Your messagehas been sent", "Theva", MessageBoxButtons.OK,   MessageBoxIcon.Information)

End Sub


Private Sub btnclear_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnclear.Click

   If (MessageBox.Show("Do you want to clear the contents?", "Theva", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes) Then




   End If

End Sub

#End Region


#Region "Methods"

    Public Sub clear()

        txtto.Text = ""

        txtfrm.Text = ""

        txtbcc.Text = ""

        txtcc.Text = ""

        txtsub.Text = ""       

        txtcont.Text = ""

    End Sub

 Public Sub Mailmessage()

        Dim m As New MailMessage

        m.From = New MailAddress(txtfrm.Text.Trim)

        m.To.Add(New MailAddress(txtto.Text.Trim, txtsendername.Text.Trim))

        m.Subject = txtsub.Text.Trim

        m.Body = txtcont.Text.Trim

        Dim client As New SmtpClient(txtSMTP.Text.Trim)


End Sub

#End Region

End Class