电子邮件的发送问题 我对.net不是很熟,照着参考书把程序打上去了,实现不了功能。对IIS中的SMTP进行了简单的设置,设置了SMTP虚拟服务器。 代码如下: Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Dim mail As MailMessage = New MailMessage mail.To = mailTo.Text mail.From = mailFrom.Text mail.Subject = mailSubject.Text mail.Body = mailBody.Text If Format.SelectedItem.Text = "纯文本格式" Then mail.BodyFormat = MailFormat.Text Else mail.BodyFormat = MailFormat.Html End If Dim file As HttpPostedFile = FileUp.postedFile If file.ContentLength <> 0 Then Dim FileSplit() As String = Split(file.FileName, "\") Dim FileName As String = FileSplit(FileSplit.Length - 1) file.SaveAs(Server.MapPath(FileName)) Dim attach As New MailAttachment(Server.MapPath(FileName)) mail.Attachments.Add(attach) End If
On Error Resume Next SmtpMail.SmtpServer = "msa.hinet.net" 这点我不懂是什么意思,请不吝赐教!! SmtpMail.Send(mail)
If Err.Number Then Label1.Text = Err.Description Else Label1.Text = "邮件已发出!" End If End Sub End Class 多谢多谢!!!!!!!!!!!