%
'''''''''''''''''''''''''''''USER DEFINED VARIABLES''''''''''''''''''''''''''''''''''''
' ERROR messages
formError = "HabÌa errores al envÌar su formulario. Por favor mire abajo los detalles."
required = "Se requiere este campo."
invalid = "Este valor no es v·lido."
' EMAIL ADDRESS that the message is sent to
emailString = "gn@gnplastics.com"
filename = server.mapPath( "/data/contactUs.log" )
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Trim spaces and replace characters that could interfere with the html display,
' then print out the result.
sub parse ( value )
value = trim( value )
value = replace( value, "&", "&" )
value = replace( value, """", """ )
value = replace( value, "<", "<" )
value = replace( value, ">", ">" )
response.write( value )
end sub
if ( Request.Form.Count > 0 ) Then
firstName = Request.Form( "firstName" )
lastName = Request.Form( "lastName" )
company = Request.Form( "company" )
position = Request.Form( "position" )
address = Request.Form( "address" )
poBox = Request.Form( "poBox" )
city = Request.Form( "city" )
state = Request.Form( "state" )
zip = Request.Form( "zip" )
country = Request.Form( "country" )
phone = Request.Form( "phone" )
fax = Request.Form( "fax" )
email = Request.Form( "email" )
url = Request.Form( "url" )
comments = Request.Form( "comments" )
valid = true
if ( len( firstName ) < 1 ) then
firstNameError = required
valid = false
end if
if ( len( lastName ) < 1 ) then
lastNameError = required
valid = false
end if
if ( len( company ) < 1 ) then
companyError = required
valid = false
end if
if ( len( position ) < 1 ) then
positionError = required
valid = false
end if
if ( len( country ) < 1 ) then
countryError = required
valid = false
end if
if ( len( phone ) < 1 ) then
phoneError = required
valid = false
end if
if ( len( email ) < 1 ) then
emailError = required
valid = false
else
if ( inStr( email, "@" )=0 ) then
emailError = invalid
valid = false
end if
end if
if ( len( comments ) < 1 ) then
commentsError = required
valid = false
end if
if ( valid ) then
tab = chr(9)
newline = chr(13) & chr(10)
' Send email
body = "date: " & date & " " & time & newline
body = body & "firstName: " & firstName & newline
body = body & "lastName: " & lastName & newline
body = body & "company: " & company & newline
body = body & "position: " & position & newline
body = body & "address: " & address & newline
body = body & "poBox: " & poBox & newline
body = body & "city: " & city & newline
body = body & "state: " & state & newline
body = body & "zip: " & zip & newline
body = body & "country: " & country & newline
body = body & "phone: " & phone & newline
body = body & "fax: " & fax & newline
body = body & "email: " & email & newline
body = body & "website: " & url & newline
body = body & "comments: " & comments & newline
Const cdoSendUsingMethod = _
"http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort = 2
Const cdoSMTPServer = _
"http://schemas.microsoft.com/cdo/configuration/smtpserver"
Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields
' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
' Set config fields we care about
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "smtp1.aliantasp.com"
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.To = emailString
.From = emailString
.Subject = "Contact Us Feedback - Spanish"
.TextBody = body
.Send
End With
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
' Write to file
contents = date & " " & time & tab & firstName & tab & lastName & tab & company
contents = contents & tab & position & tab & address & tab & poBox
contents = contents & tab & city & tab & state & tab & zip
contents = contents & tab & country & tab & phone & fax & tab & email
contents = contents & tab & url & tab & comments & newline
'set oFs = Server.Createobject("Scripting.FileSystemObject")
'set oTextFile = oFs.OpenTextFile(filename, 8, True)
'oTextFile.Write contents
'oTextFile.Close
'set oTextFile = nothing
'set oFS = nothing
response.redirect( "Thanks.html" )
else
globalError = formError
end if
end if
%>