|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Asp email form on godaddy
i have a form i'm using and would like to embed it into my site. i've set up a test location on my godaddy server which is asp enabled. my problem is that when I go to submit my completed for, I get
'page cannot be displayed' error. Here is my form: http://www.plymouthtravelvet.com/test/contact.htm here is my asp code: <% ' declare variables Dim EmailFrom Dim EmailTo Dim Subject Dim Name Dim Address Dim City Dim State Dim PostCode Dim Tel Dim Department Dim Website ' get posted data into variables EmailFrom = "xxxx@gmail.com" EmailTo = "xxxxx@gmail.com" Subject = "xxxxxx" Name = Trim(Request.Form("Name")) Address = Trim(Request.Form("Address")) City = Trim(Request.Form("City")) State = Trim(Request.Form("State")) PostCode = Trim(Request.Form("PostCode")) Tel = Trim(Request.Form("Tel")) Department = Trim(Request.Form("Department")) Website = Trim(Request.Form("Website")) ' validation Dim validationOK validationOK=true If (validationOK=false) Then Response.Redirect("error.htm?" & EmailFrom) ' prepare email body text Dim Body Body = Body & "Name: " & Name & VbCrLf Body = Body & "Address: " & Address & VbCrLf Body = Body & "City: " & City & VbCrLf Body = Body & "State: " & State & VbCrLf Body = Body & "PostCode: " & PostCode & VbCrLf Body = Body & "Tel: " & Tel & VbCrLf Body = Body & "Department: " & Department & VbCrLf Body = Body & "Website: " & Website & VbCrLf ' send email Dim mail using System.Web.Mail; private void SendEmail() { const string SERVER = "relay-hosting.secureserver.net"; MailMessage Mail = new System.Web.Mail.MailMessage(); mail.To = EmailTo mail.From = EmailFrom mail.Subject = Subject mail.Body = Body SmtpMail.SmtpServer = SERVER; SmtpMail.Send(Mail); Mail = null; // free up resources } ' redirect to success page Response.Redirect("ok.htm?" & EmailFrom) %> some of this was taken from here Why won't the form send me an email? what changes should i make to my asp code? thanks! |
|
#2
|
|||
|
|||
|
I also noticed that godaddy put 'gdform.asp' on my root, here is the source if you think it would help us figure out what we need to do:
<% 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("Scripting.FileSystemObject") host_url = Request.ServerVariables("HTTP_HOST") req_method = Request.ServerVariables("REQUEST_METHOD") 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(filename, 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 %> |
|
#3
|
|||
|
|||
|
nothin eh?
|
|
#4
|
||||
|
||||
|
are you using Classic ASP or ASP.NET? The link you posted for the code is .NET. which would mean that your page should end with .aspx not .asp.
also, if you turn off friendly error messages on your browser, you would get a better error message: Code:
Microsoft VBScript compilation error '800a0401' Expected end of statement /test/contact.asp, line 49 using System.Web.Mail; ---------------------^ so it's telling you that line 49 on your contact.asp page is where the error is. which is the line using System.Web.Mail which is a .NET statement.
__________________
Come JOIN the party!!! Quote of the Month: Pretension: The downside of being better than everyone else is that people tend to assume you're pretentious. Questions to Ponder: You can be overwhelmed and underwhelmed, but why can't you be simply whelmed? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright© 2008 sbenj69 |
|
#5
|
|||
|
|||
|
so line 49 needs to be changed, but what do I need to do to ensure a correctly formatted asp page? Im completely new to this, but i'm confident once i see a working example I will get the hang of it, thanks!
|
|
#6
|
||||
|
||||
|
again ... are you using ASP or .NET? ... you need to figure this out first. If it's .NET, then you should post this question in the .NET forum. if you're using regular ASP, there is a lot of help in this forum for ASP Email with CDOSYS, just run a search.
|
|
#7
|
|||
|
|||
|
Honestly, I'm not quite sure. A doctor (vet) is friends with my parents and I'm doing this site for him for free - I've built sites with dreamweaver before, but he has requested an email form so his clients can post questions or buy product from him through the site. That said, I used a form generator from here to make the thing:
http://www.tele-pro.co.uk/scripts/contact_form/ The script language says 'asp' so i assume classic asp. thank you for your help. |
|
#8
|
||||
|
||||
|
i went and looked at your form generator and since i'm not sure whether GoDaddy uses CDONTS or CDOSYS ... try using the code that the form generator created for contact.asp with your form and see if that works ... (it's using CDONTS), if it doesn't we can then convert that code to CDOSYS.
i would suggest not using goDaddy's ASP Form Mailer. which is the page it created for you (gdform.asp) [edit]just ran a test on godaddy's hosting, they run both CDONTS and CDOSYS ... so the code that your code generator created for contact.ASP should work as is. Last edited by mehere : May 17th, 2006 at 05:23 PM. |
|
#9
|
|||
|
|||
|
Wrong language...
It's because the "mail" method and code is C#. Asp won't run with C# as the language. The code you got from the web is for ASP.NET, not asp. These links may help, if not, check google for links on sending email using VBScript.
URL URL Hope this helps! Brian |
|
#10
|
|||
|
|||
|
I am having a similar problem
I am having a similar problem with an asp mail form on godaddy.com. I turned off the friendly error messages on my browser and still get the stupid godaddy error page. My page is at www.saramayman.com/panoramic/contact.asp.
Quote:
|
|
#11
|
||||
|
||||
|
I run both aspx and asp on my domain on a godaddy server. I also have a problem with sending email. I think it's a godaddy configuration issue which someone figured out a workaround to, just waiting for him to remember what it was and get back to me.
|
|
#12
|
||||
|
||||
|
i'm using a asp sendmail form with godaddy.com and i have never had a single problem with it. if you want i can zip it up and post it on here.
|
|
#13
|
|||
|
|||
|
Hey NFL2k22, did you ever get it to work? If so, can you tell me what you did?
|
|
#14
|
|||
|
|||
|
I need your help
Quote:
I am having problems with my asp mail form and would greatly appreciate any help you could provide. Thanks for everything! |
|
#15
|
|||
|
|||
|
Shouldnt your page name be :
http://www.plymouthtravelvet.com/test/contact.asp instead of http://www.plymouthtravelvet.com/test/contact.htm I mean i hope its an .asp file???the code looks to be ASP code...let me know |
| Viewing: ASP Free Forums > Programming > ASP Development > Asp email form on godaddy |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|