Dim objConn As New System.Data.SqlClient.SqlConnection
Dim dtAdapter As System.Data.SqlClient.SqlDataAdapter
Dim dt As New DataTable
Dim strConnString As String
strConnString = "Server=localhost;UID=sa;PASSWORD=;database=mydatabase;Max Pool Size=400;Connect Timeout=600;"
objConn = New System.Data.SqlClient.SqlConnection(strConnString)
objConn.Open()
Dim strSQL As String
strSQL = "SELECT * FROM customer"
dtAdapter = New System.Data.SqlClient.SqlDataAdapter(strSQL, objConn)
dtAdapter.Fill(dt)
dtAdapter = Nothing
objConn.Close()
objConn = Nothing
Dim myMail As MailMessage()
Dim i As Integer
For i = 0 To dt.Rows.Count - 1
myMail = New MailMessage()
myMail.From = New MailAddress("[email protected]")
myMail.To.Add(New MailAddress(dt.Rows(i)("Email"))
myMail.Subject = Me.txtSubject.Text
myMail.Body = Me.txtMessage.Text
myMail.Priority = MailPriority.High ' MailPriority.High , MailPriority.Low MailPriority.Normal
Dim Client As New SmtpClient()
'Client.Host = "192.168.0.1"
Client.Send(myMail)
Next