ASP.net….

 

   Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        Dim MailMessage As New System.Net.Mail.MailMessage

        MailMessage.From = New System.Net.Mail.MailAddress("steve@schimsky.com")

        MailMessage.To.Add(New System.Net.Mail.MailAddress("schimsky@hotmail.com"))

        MailMessage.Subject = "this is a test"

        MailMessage.Body = "hello world!"

        MailMessage.Attachments.Add(New System.Net.Mail.Attachment("q:\data\look.txt"))

        MailMessage.IsBodyHtml = True

 

 

        Dim SmtpClient As New System.Net.Mail.SmtpClient("localhost")

        SmtpClient.Send(MailMessage)

        Response.Write("Done.")

 

 

    End Sub

 

 

VB.net….

 

imports System.Net.Mail

 

Public Class Form1

 

 

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

 

        Try

            Dim SmtpServer As New SmtpClient()

            Dim mail As New MailMessage()

            'SmtpServer.Credentials = New System.Net.NetworkCredential("Schimsky", "xxx")

            'SmtpServer.Port = 587

            SmtpServer.Host = "smtp-server.tampabay.rr.com"

            mail = New MailMessage()

            mail.From = New MailAddress("Walt@Disney.com")

            mail.To.Add("Schimsky@hotmail.com")

            mail.Subject = "Test Mail 111"

            mail.Body = "This is for testing SMTP mail from GMAIL"

            SmtpServer.Send(mail)

            MsgBox("mail sent")

        Catch ex As Exception

            MsgBox(ex.ToString)

        End Try

 

 

    End Sub