ASP Send Mail Example
<% InputMailTo = Trim (Request.Form ( "inputMailTo")) inputMailFrom = Trim (Request.Form ( "inputMailFrom")) inputMailSubject = Trim (Request.Form ( "inputMailSubject")) textBoxMailBody = Trim (Request.Form ( " TextBoxMailBody "))
Dim errmsginputmailto, errmsginputmailfrom, errmsginputmailsubject, errmsgtextboxmailbody, msgsendresult
Sendmail
sub sendMail () if inputMailTo = "" thenErrMsgInputMailTo = "not empty" exit subend ifif ValidateEmail (inputMailTo) = false thenErrMsgInputMailTo = "E-Mail Address Error" exit subend ifif inputMailFrom = "" thenErrMsgInputMailFrom = "not empty" exit subend ifif validateEmail (inputMailFrom) = false thenErrMsgInputMailFrom = "E-Mail Address Error" exit subend ifif inputMailSubject = "" thenErrMsgInputMailSubject = "not empty" exit subend ifif textBoxMailBody = "" thenErrMsgTextBoxMailBody = "not empty" exit subend if
Set mail = server.createObject ("cdonts.newmail") mail.to = inputmailtomail.from = inputmailfrommail.subject = inputmailsubjectmail.body = TextBoxMailBodymail.send
MsgsendResult = "Send success! From:" infutmailfrom "; to:" InputMailto
End Sub%>