%
'some logic to check whether there is an email to send.
'define form variables
dim dbName, dbEmail1, dbSuburb, dbContacts, dbComments, message, showform
dim pageTitle
pageTitle = "Feedback form"
message = ""
showform = "Yes"
IF request.querystring("submit") = "yes" THEN 'there a submit
dbName = TRIM(request.form("dbName"))
dbEmail1 = TRIM(request.form("dbEmail1"))
dbSuburb = TRIM(request.form("dbSuburb"))
dbContacts = TRIM(request.form("dbContacts"))
dbComments = TRIM(request.form("dbComments"))
IF dbName = "" AND dbEmail1 = "" AND dbSuburb = "" AND dbContacts = "" AND dbComments = "" THEN
message = "You must complete at least one field in the form."
ELSE
showform = "No"
END IF
END IF
%>
<%
'this is the start of the main body.
%>
<%
IF showform = "Yes" THEN 'Show form
%>
<%
ELSE
%>
Thank you for your feedback.
<%
'make up email
'check field values
dbName = updateFields(dbName)
dbEmail1 = updateFields(dbEmail1)
dbSuburb = updateFields(dbSuburb)
dbContacts = updateFields(dbContacts)
dbComments = updateFields(dbComments)
dim emailBody
emailBody = ""&_
""&_
""&_
""&_
"  "&_
" Result from Woodlawn Alternative Waste Technology Facilities website feedback form"&_
" Name" & (dbName) &_
" Email Address" & (dbEmail1) &_
" Suburb" & (dbSuburb) &_
" Contact details" & (dbContacts) &_
" Comments" & (dbComments) & " |
"
'set up for email send
dim smtpserver, messagesubject, iMsg, iConf , Flds
smtpserver = "Smtp.vps.net.au"
'smtpserver = "smtp-au.server-mail.com"
'smtpserver = "smtp.pacific.net.au"
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
'mailfrom = "geoff@pmpdigitaldesign.com" 'needs this for security on server
mailfrom = "mail@umwelt.com.au" 'needs this for security on server
'mailTo = "geoff@pmpdigitaldesign.com"
mailTo = "mail@umwelt.com.au"
thesubject = "collex_woodlawn - feedback."
'generate the email
With iMsg
'send email
Set .Configuration = iConf
.To = cstr(mailTo)
.From = cstr(mailfrom)
.Sender = cstr(mailfrom)
.Subject = cstr(thesubject)
.HTMLBody = cstr(emailBody)
.Send
End With
END IF
%>
<%
function updateFields(value)
IF value = "" THEN
value = "Unspecified."
ELSE
value = Server.HTMLEncode(value)
END IF
updateFields = value
end function
%>