Dim ln As String = vbcrlf & vbcrlf '定义两个换行
With Tables("对帐单")
If .TopPosition > -1 Then
Dim Result As DialogResult
Result = MessageBox.Show("确定发送吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
For i As Integer = .BottomPosition To .TopPosition Step -1
‘必须放到循环里面定义邮件对象
Dim m As New MailSender
m.EnableSsl = True
m.Host = "smtp.qq.com"
m.Account =
m.Password =
m.From =
m.To = .Rows(i)("邮箱")
m.Title = "对帐单"
m.C & .Rows(i)("供应商") & ":" & ln & "您的订单【" & .Rows(i)("款号") & "】款对帐如下:" & vbcrlf
m.Content = m.Content & "合同号: " & .Rows(i)("订购单号") & vbcrlf & "合同单价(16%税): " & .Rows(i)("合同单价(16%税)") & vbcrlf & "单价(13%税): " & .Rows(i)("单价(13%税)") & vbcrlf & "合同总金额: " & .Rows(i)("合同总金额") & vbcrlf & "计划到货时间: " & .Rows(i)("计划到货_时间") & vbcrlf & "计划到货数量: " & .Rows(i)("计划到货_数量") & vbcrlf & "款名: " & .Rows(i)("款名") & vbcrlf & "实际可开piao数量: " & .Rows(i)("实际可开piao_数量") & vbcrlf & "实际可开piao金额: " & .Rows(i)("实际可开piao_金额") & vbcrlf & vbcrlf & user.Name & "-" & Date.Now
m.SendAsync()
.Rows(i)("发送") = True
Next
DataTables("对帐单").Save()
End If
End If
PopMessage("发送成功!",,,7)
End With
[此贴子已经被作者于2020/3/27 16:27:13编辑过]