% If Request.Form("txtemail") <> "" Then 'The header/footer for the email. Const strHeader = "Here are the results of the form:" Const strFooter = "Form mailer created by 4GuysFromRolla.com, 1999" 'Who does this go to? MAKE SURE TO CHANGE THIS TO YOUR EMAIL ADDRESS! Const strTo = "jackferraro@foxhayes.co.uk; emmanewton@foxhayes.co.uk; davidgill@foxhayes.co.uk" 'This information is optional Dim strFrom, strSubject, strRedirectURL, strFromPath 'strFrom = Request.Form("txtemail") 'if Len(strFrom) = 0 then strFrom = strTo strFrom = "davidgill@foxhayes.co.uk" strSubject = "Contact from the Building Site Website" if Len(strSubject) = 0 then strSubject = "FORM EMAILER: 4GuysFromRolla.com" strRedirectURL = "Contact.htm" if Len(strRedirectURL) = 0 then strRedirectURL = "/" strFromPath = "Contact.asp" if Len(strFromPath) = 0 then strFromPath = "UNKNOWN" Dim strBody strBody = strHeader & ( vbCrLf & vbCrLf ) strBody = strBody & ( "FORM: " & strFromPath & vbCrLf ) & _ ( "FORM submitted at " & Now() & vbCrLf & vbCrLf ) dim ix, formElementName, formElementValue, prefix, fldName For ix = 1 to Request.Form.Count formElementName = Request.Form.Key(ix) formElementValue = Request.Form.Item(ix) ' what type of field was that on the form? prefix = Left(formElementName,3) ' and throw away prefix to get actual field name fldName = Mid(formElementName,4) ' but change periods to spaces for readability fldName = Replace(fldName, "."," ") Select Case prefix ' if the prefix indicates this is a form field of interest... Case "txt","sel","rad","cbo","lst","chk": ' if user didn't answer this question, say so... if Len(formElementValue) = 0 then formElementValue = "UNANSWERED" ' then tack on the name of the field and the answer strBody = strBody & (fldName & ": " & formElementValue & vbCrLf) End Select Next strBody = strBody & ( vbCrLf & vbCrLf & "-- " & vbCrLf & strFooter ) 'Time to send the email Dim ObjSendMail Set ObjSendMail = CreateObject("CDO.Message") ObjSendMail.To = strTo ObjSendMail.Subject = strSubject ObjSendMail.From = strFrom ' 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 = strBody 'This section provides the configuration information for the remote SMTP server. ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network). ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="192.168.2.25" ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False) ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 ' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password. ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="poulterk@foxhayes.local" ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="nx9110" ObjSendMail.Configuration.Fields.Update 'End remote SMTP server configuration section== ObjSendMail.Send Set ObjSendMail = Nothing Response.Redirect "Contact.htm" End If %>