Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
Dim smtpserver As New SmtpClient
smtpserver.Credentials = New Net.NetworkCredential("[email protected]", "xxxxx")
smtpserver.Host = "smtp.live.com"
smtpserver.Port = "587"
Dim des As New TohomeCenter.EmCRMLib.Encryption
Dim mail As New MailMessage
Dim i As Integer
For i = 0 To dt.Rows.Count - 1
mail = New MailMessage
mail.From = New MailAddress("[email protected]")
mail.To.Add(New MailAddress(dt.Rows(i)("emailname")))
mail.Subject = txtSuject.Text
mail.Body = txtmess.Text.Replace("<!--Link-->", "<a href=""http://localhost:65150/TEST/frmemailcancel.aspx?email=" & des.EncryptString(Me.txtto.Text) & """ target=""_blank"">")
mail.IsBodyHtml = True
smtpserver.EnableSsl = True
smtpserver.Send(mail)
MessageBox.Show("send mail ok")
Next
Catch ex As Exception
MsgBox("error")
End Try
End Sub
Tag : .NET, Ms SQL Server 2005, Ms SQL Server 2008, VB.NET
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
Dim smtpserver As New SmtpClient
smtpserver.Credentials = New Net.NetworkCredential("[email protected]", "xxxxxx")
smtpserver.Host = "smtp.live.com"
smtpserver.Port = "587"
Dim des As New TohomeCenter.EmCRMLib.Encryption
Dim mail As New MailMessage
Dim i As Integer
For i = 0 To dt.Rows.Count - 1
mail = New MailMessage
mail.From = New MailAddress("[email protected]")
mail.To.Add(New MailAddress(dt.Rows(i)("emailname")))
mail.Subject = txtSuject.Text
mail.Body = txtmess.Text.Replace("<!--Link-->", "<a href=""http://localhost:65150/TEST/frmemailcancel.aspx?email=" & des.EncryptString(Me.txtto.Text) & """ target=""_blank"">")
mail.IsBodyHtml = True
smtpserver.EnableSsl = True
smtpserver.Send(mail)
MessageBox.Show("send mail ok")
IF i mod 20 = 0 Then
Thread.Sleep(60000)
End IF
Next
Catch ex As Exception
MsgBox("error")
End Try
End Sub