这个vb.net代码似乎只运行 如果运行...并且在我看到“发送电子邮件”消息后,我会让程序再打开5-10秒。如果我改为等待0-1秒,然后关闭prg,则电子邮件无处可去。
在电子邮件完全发送后,SMTP.Send()是否会返回...或者只是当电子邮件BEGINS出去时? (有时,电子邮件正文和/或文件附件可能长达10k,需要一段时间。)
Dim myMailMessage As New Net.Mail.MailMessage() myMailMessage.From = New Net.Mail.MailAddress(fromEmail) myMailMessage.To.Add(toEmail) myMailMessage.Subject = strSubject myMailMessage.Body = strBody myMailMessage.IsBodyHtml = True Dim SMTP As New Net.Mail.SmtpClient("smtp.gmail.com") SMTP.Port = 587 SMTP.EnableSsl = True SMTP.Credentials = New System.Net.NetworkCredential(fromEmail, password) SMTP.Send(myMailMessage) call MsgBox("Email is completely done sending")