我使用此代码使用SMTP发送电子邮件
Dim clnt As New System.Net.Mail.SmtpClient
clnt.UseDefaultCredentials = False
clnt = New System.Net.Mail.SmtpClient(gate)
Dim auth_info As System.Net.NetworkCredential = New System.Net.NetworkCredential(toAddress, pass)
'// MESSAGE SETUP
Dim msg As New System.Net.Mail.MailMessage(fromAddress, toAddress)
If msg.To.Count = 0 Then Return False
msg.CC.Clear()
'// SEND A COPY TO SENDER
'msg.Bcc.Add(auth_info.UserName)
msg.Bcc.Add(fromAddress)
'msg.DeliveryNotificationOptions = Net.Mail.DeliveryNotificationOptions.OnFailure
'msg.DeliveryNotificationOptions = Net.Mail.DeliveryNotificationOptions.OnSuccess
msg.Headers.Add("Disposition-Notification-To", fromAddress)
msg.Subject = subject
msg.Body = msgbody
msg.IsBodyHtml = True
Dim serverBusy As Boolean = True
While serverBusy
Try
clnt.Send(msg)
serverBusy = False
Catch
serverBusy = True
End Try
End While