marcum
asked on
Convert frontpage Form mailer to Godaddy's ASP form mailer.
I have a website that we just moved the hosting to godaddy. now some of the forms do not work. I want to convert the script to use GoDaddy's form mailer.
On the current script when I submit it does not send the mail and it will not direct me to the Thank you page. here is a code snippit of the current script.
<form method="POST" name="FrontPage_Form1" action="--WEBBOT-SELF--" onsubmit="return FrontPage_Form1_Validator( this)" language="JavaScript">
<!--webbot bot="SaveResults" U-File="C:\xxxx\xxxx2007\_ private\fo rm_results .txt" S-Format="TEXT/CSV" S-Label-Fields="TRUE" B-Reverse-Chronology="FALS E" S-Email-Format="TEXT/PRE" S-Email-Address="WEBFORM@x xxx.COM" B-Email-Label-Fields="TRUE " B-Email-ReplyTo-From-Field ="TRUE" S-Email-ReplyTo="email" B-Email-Subject-From-Field ="FALSE" S-Email-Subject="Send Me An Instant Quote" S-Builtin-Fields="REMOTE_N AME REMOTE_USER HTTP_USER_AGENT" S-Form-Fields="name address city state zip dayphone evephone email Services OtherComments " U-Confirmation-Url="thanks 2.htm" -->
<div align="center">
With godaddy they use an asp script called gdform.asp. Here is the code snippit they recommend.
<form action="gdform.asp" method="post">
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />
<p>First Name:<input type="text" name="FirstName" /></p>
<p>Last Name:<input type="text" name="LastName" /></p>
<p>E-Mail:<input type="text" name="email" /></p>
<p>Comments:<textarea name="comments" cols="40" rows="10">
Type comments here.</textarea></p>
<input type="submit" name="submit" value="submit"/>
</form>
How do I alter my current script to utilize godaddy's form mailer.
Thanks
On the current script when I submit it does not send the mail and it will not direct me to the Thank you page. here is a code snippit of the current script.
<form method="POST" name="FrontPage_Form1" action="--WEBBOT-SELF--" onsubmit="return FrontPage_Form1_Validator(
<!--webbot bot="SaveResults" U-File="C:\xxxx\xxxx2007\_
<div align="center">
With godaddy they use an asp script called gdform.asp. Here is the code snippit they recommend.
<form action="gdform.asp" method="post">
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />
<p>First Name:<input type="text" name="FirstName" /></p>
<p>Last Name:<input type="text" name="LastName" /></p>
<p>E-Mail:<input type="text" name="email" /></p>
<p>Comments:<textarea name="comments" cols="40" rows="10">
Type comments here.</textarea></p>
<input type="submit" name="submit" value="submit"/>
</form>
How do I alter my current script to utilize godaddy's form mailer.
Thanks
ASKER
any other idea's?
As I said I got the script to work now I just need to make it redirect to the thank you page.
Here is GoDaddy's gdform.asp
<%
Dim landing_page, host_url
Dim fso, outfile, filename, dirname, myFolder
Dim req_method, key, value
Dim bErr, errStr, bEmpty
On Error resume next
bErr = false
bEmpty = true
errStr = ""
Set fso = Server.CreateObject("Scrip ting.FileS ystemObjec t")
host_url = Request.ServerVariables("H TTP_HOST")
req_method = Request.ServerVariables("R EQUEST_MET HOD")
dtNow = Now()
filename = Server.MapPath("\ssfm")
dirname = filename
filename = filename & "\gdform_" & DatePart("M", dtNow) & DatePart("D", dtNow) & DatePart("YYYY", dtNow) & DatePart("N", dtNow) & DatePart("S", dtNow)
Function FormatVariableLine(byval var_name, byVal var_value)
Dim tmpStr
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " START>" & vbCRLF
tmpStr = tmpStr & var_value & vbCRLF
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " END>"
FormatVariableLine = tmpStr
end function
Sub OutputLine(byVal line)
outfile.WriteLine(line)
end sub
if err.number = 0 then
Set outfile = fso.CreateTextFile(filenam e, true, false)
if err.number <> 0 then
bErr = true
errStr = "Error creating file! Directory may not be writable or may not exist.<br>Unable to process request."
else
if(req_method = "GET") then
for each Item in request.QueryString
if item <> "" then
bEmpty = false
key = item
value = Request.QueryString(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
elseif (req_method = "POST") then
for each Item in request.form
if item <> "" then
bEmpty = false
key = item
value = Request.form(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
end if
outfile.close
end if
if(bEmpty = true) AND errStr = "" then
bErr = true
errStr = errStr & "<br>No variables sent to form! Unable to process request."
end if
if(bErr = false) then
if (landing_page <> "") then
response.Redirect "http://" & host_url & "/" & landing_page
else
response.Redirect "http://" & host_url
end if
else
Response.Write errStr
end if
set fso = nothing
else
Response.Write " An Error Occurred creating mail message. Unable to process form request at this time."
end if
%>
As I said I got the script to work now I just need to make it redirect to the thank you page.
Here is GoDaddy's gdform.asp
<%
Dim landing_page, host_url
Dim fso, outfile, filename, dirname, myFolder
Dim req_method, key, value
Dim bErr, errStr, bEmpty
On Error resume next
bErr = false
bEmpty = true
errStr = ""
Set fso = Server.CreateObject("Scrip
host_url = Request.ServerVariables("H
req_method = Request.ServerVariables("R
dtNow = Now()
filename = Server.MapPath("\ssfm")
dirname = filename
filename = filename & "\gdform_" & DatePart("M", dtNow) & DatePart("D", dtNow) & DatePart("YYYY", dtNow) & DatePart("N", dtNow) & DatePart("S", dtNow)
Function FormatVariableLine(byval var_name, byVal var_value)
Dim tmpStr
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " START>" & vbCRLF
tmpStr = tmpStr & var_value & vbCRLF
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " END>"
FormatVariableLine = tmpStr
end function
Sub OutputLine(byVal line)
outfile.WriteLine(line)
end sub
if err.number = 0 then
Set outfile = fso.CreateTextFile(filenam
if err.number <> 0 then
bErr = true
errStr = "Error creating file! Directory may not be writable or may not exist.<br>Unable to process request."
else
if(req_method = "GET") then
for each Item in request.QueryString
if item <> "" then
bEmpty = false
key = item
value = Request.QueryString(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
elseif (req_method = "POST") then
for each Item in request.form
if item <> "" then
bEmpty = false
key = item
value = Request.form(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
end if
outfile.close
end if
if(bEmpty = true) AND errStr = "" then
bErr = true
errStr = errStr & "<br>No variables sent to form! Unable to process request."
end if
if(bErr = false) then
if (landing_page <> "") then
response.Redirect "http://" & host_url & "/" & landing_page
else
response.Redirect "http://" & host_url
end if
else
Response.Write errStr
end if
set fso = nothing
else
Response.Write " An Error Occurred creating mail message. Unable to process form request at this time."
end if
%>
ASKER
ASKER
so add my page info directly after the http:// ???
yes
ASKER
that didn't work.. it doubled my url statement.
host_url = Request.ServerVariables("H TTP_HOST") ...it may not like that
or response.Redirect "http://somewhere.com/thankyou.asp"
else
response.Redirect "http://" & host_url
or response.Redirect "http://somewhere.com/thankyou.asp"
else
response.Redirect "http://" & host_url
ASKER
nope, it just redirects me to the root of the domain
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that works thanks
cool - Thanks for the points
ASKER
to action="gdform.asp"
Now it mails but it will not direct me to the thank you page.
Any suggestions?