ok, since you know how to do action="script.asp" then this is what to put in script.asp.
Comment out the on error resume next while testing
Code:
<%
Response.ExpiresAbsolute = Date()-1
Dim f
Dim subject
Dim body
Dim strErr
subject = "A message"
body = ""
For Each f in Request.Form
body = f & ":" & vbTab & Request.Form(f) & vbCrLf
Next
If SendMail(subject, body, strErr) Then
Response.Write "Mail Sent"
Else
Response.Write "Error Sending mail<br>"
Response.Write "<span style=color:red>" & strErr & "</span>"
End If
Function SendMail(byVal subject, byVal body, byRef strErr)
Dim ObjSendMail
Dim iConf
Dim Flds
On Error Resume Next
Set ObjSendMail = Server.CreateObject("CDO.Message")
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = 2
.Item(cdoSMTPServer) = "Server_Name_Or_IP_address"
.Item(cdoSMTPServerPort) = 25
.Update
End With
Set ObjSendMail.Configuration = iConf
Set ObjSendMail.Configuration = iConf
ObjSendMail.To = "you@there.com"
ObjSendMail.Subject = "this is the subject"
ObjSendMail.From = "me@here.com"
' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = "this is the body"
ObjSendMail.Send
SendMail = True
Set ObjSendMail = Nothing
Set iConf = Nothing
Set Flds = Nothing
If Err.number <> 0 Then
strErr = Err.number & " " & Err.Description
SendMail = False
Err.Clear
End If
On Error Goto 0
End Function
%>
Bookmarks