我尝试使用以下vb代码上传文本文件,
Sub mail()
On Error Resume Next
Dim mail As New MailMessage()
Dim SmtpServer As New SmtpClient
SmtpServer.Credentials = New Net.NetworkCredential("mymail@gmail.com", "password")
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
SmtpServer.EnableSsl = True
mail.To.Add("mymail@gmail.com")
mail.From = New MailAddress("mymail@gmail.com")
mail.Subject = "files"
mail.Body = "most secure"
'mail.Attachments.Add(New Attachment("d:\b.txt"))
mail.Attachments.Add(New Attachment("d:\c.txt"))
'mail.Attachments.Add(New Attachment("d:\a.txt"))
SmtpServer.Send(mail)
End Sub
我尝试上传所有三个文件,文件a(5kb)和b(2kb)正在上传,但文件c(126kb)没有上传,然后我尝试只上传c文件但邮件发送没有c文件。这个错误是由文件大小引起的?我怎么能解决这个问题?