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 fj As String = drs(kii)("邮箱")
Dim sj As String = ""
Dim i As Integer = 0
Dim drs1 As List(Of DataRow)
Dim sjs As String
Dim sjr As String
Dim csr As String
Dim Filter As String
Dim dr As DataRow
Dim drcz As DataRow
Dim drf As DataRow
Dim Wff As DataRow
Dim Products As List(Of String)
Products = DataTables("APQP发送邮件详情").GetValues("收件人邮箱","","[_SortKey]")
For Each Product As String In Products
If Product <> "" Then
i = i + 1
If sj = "" Then
sj = Product
Else
mail.cc.Add(Product) '抄送
End If
csr = csr & "/" & Product
End If
Next
Dim smtp As New System.Net.Mail.SmtpClient(dz,dk)
smtp.EnableSsl = True 'SSL
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,"EAPQP系统自动发送:" & tb1.value)
mail.Priority = System.Net.Mail.MailPriority.Normal
mail.IsBodyHtml = True
' mail.Body = nr
mail.Body = body
sj = sj.Trim(",")
'MessageBox.Show(400)
If FileSys.DirectoryExists(CF_Address & "TempEmail\" & _UserName & "\") Then '如果目录C:\MyFolder存在
For Each File As String In FileSys.GetFiles(CF_Address & "TempEmail\" & _UserName & "\")
Dim attachment As new System.Net.Mail.Attachment(file, System.Net.Mime.MediaTypeNames.Application.Octet)
mail.Attachments.Add(attachment)
Next
End If
' MessageBox.Show(33333)
mail.To.Add(sj)