我收到了指出的错误。我显然不知道我在这里做什么。我应该使用什么库?我在 objMail.Send() 行上收到错误消息。我收到的代码最初是从 .asp 中截获的会试一试。任何帮助是极大的赞赏。
<%@ Import Namespace="System.Net.Mail" %>
<%
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Name
Dim LastName
' get posted data into variables
EmailFrom = "test@test.com"
EmailTo = "gfuller@unum.com"
Subject = "OMAR adhoc"
Name = Trim(Request.Form("Name"))
LastName = Trim(Request.Form("LastName"))
' validation
Dim validationOK
validationOK=true
If (validationOK=false) Then Response.Redirect("error.htm?" & EmailFrom)
' prepare email body text
Dim Body
Body = Body & "Name: " & Name & VbCrLf
Body = Body & "LastName: " & LastName & VbCrLf
' send email
Dim objMail As MailMessage = Server.CreateObject("CDONTS.NewMail")
'mail = Server.CreateObject("CDONTS.NewMail")
objMail.To.Add(EmailTo)
'objMail.To = EmailTo
objMail.From = EmailFrom
objMail.Subject = Subject
objMail.Body = Body
objMail.Send()
' redirect to success page
Response.Redirect("ok.htm?" & EmailFrom)
%>