老师,发送邮件是主发一个,其他人员抄送,能否改为一次性发送,而不是抄送?
Dim mail As New System.Net.Mail.MailMessage()
Dim Result As DialogResult
Dim dz As String = drs(kii)("域名")
Dim dk As String = drs(kii)("端口")
Dim zh As String = drs(kii)("账号")
Dim mm As String= drs(kii)("密码")
Dim sj As String = ""
Dim i As Integer = 0
Dim zt As String
Dim Products As List(Of String)
Products = DataTables("表A").GetValues("收件人邮箱","","") ‘循环要发送的收件人列表
For Each Product As String In Products
If sj = "" Then
sj = Product
Else
sj = sj & ";" & Product ’===== 这样改发送不出去
' mail.cc.Add(Product) '抄送,一次性全部抄送才能发出去
End If
csr = csr & "/" & Product
Next
zt = tb11 ’主题
nr = tb22 ‘内容
Dim smtp As New System.Net.Mail.SmtpClient(dz,dk)
smtp.Credentials = New System.Net.NetworkCredential(zh,mm)
mail.Subject = zt
mail.SubjectEncoding = System.Text.Encoding.GetEncoding("GB2312")
mail.BodyEncoding = System.Text.Encoding.GetEncoding("GB2312")
mail.From = New System.Net.Mail.MailAddress(fj,"系统自动发送: )
mail.Priority = System.Net.Mail.MailPriority.Normal
mail.IsBodyHtml = True
mail.Body = nr
sj = sj.Trim(",")
mail.To.Add(sj)
smtp.Send(mail)