AstrSql = "select Email地址 from 员工 where 发送邮件='是' and 状态='在職' and Email地址<>''"
' Acmd.CommandText = AstrSql
' Ared = Acmd.ExecuteReader
' Dim AEmail As String = ""
' While Ared.Read
' AEmail = AEmail & Trim(Ared("Email地址")) & ","
' End While
' If AEmail <> "" Then
' AEmail = AEmail.Substring(0, AEmail.Length - 1)
' SmtpMail.SmtpServer.Insert(0, "127.0.0.1 or your mail server name here")
' '郵件服務器IP地址
' Dim mail As New MailMessage
' SmtpMail.SmtpServer = "192.168.1.5"
' mail.From = "junjun.su@adplustech.com"
' mail.To = AEmail
可以實現從數據庫獲取數據群發郵件
AstrSql = "select Email地址 from 员工 where 发送邮件='是' and 状态='在職' and Email地址<>''"
' Acmd.CommandText = AstrSql
' Ared = Acmd.ExecuteReader
' Dim AEmail As String = ""
' While Ared.Read
' AEmail = AEmail & Trim(Ared("Email地址")) & ","
' End While
' If AEmail <> "" Then
' AEmail = AEmail.Substring(0, AEmail.Length - 1)
' SmtpMail.SmtpServer.Insert(0, "127.0.0.1 or your mail server name here")
' '郵件服務器IP地址
' Dim mail As New MailMessage
' SmtpMail.SmtpServer = "192.168.1.5"
' mail.From = "junjun.su@adplustech.com"
' mail.To = AEmail