mal100 Posted July 16, 2009 Share Posted July 16, 2009 ive been trying to get my html form sent to my email using asp but everytime i go and click submit when i test it all that shows up is the asp code that i have written any help would be greatly appreciated ive just being using a tutorial with their code ive been wanting to send it to my gmail account thanks <html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>NameĀ Age</title></head><body><form method="GET" action="tizagGet.asp">Name <input type="text" name="Name"/>Age <input type="text" name="Age"/><input type="submit" /></form></body></html> and heres my asp <%Dim name, ageName = Request.QueryString("Name")Age = Request.QueryString("Age")Response.Write("Name: " & name & "<br />")Response.Write("Age: " & age & "<br />")%> Link to comment Share on other sites More sharing options...
justsomeguy Posted July 16, 2009 Share Posted July 16, 2009 If it's printing the code instead of executing it, it sounds like the server doesn't support ASP. Contact your host and figure out if you need to do something to enable ASP on your account. Link to comment Share on other sites More sharing options...
mal100 Posted July 16, 2009 Author Share Posted July 16, 2009 it supports it because i followed a step by step tutorial for a really basic script that said if you get the following output then your server accepts ASP is there anyone that knows of a step by step tutorial that can guide me through how to set it up straight to my gmail account that would be great or someone jus tell me what to search for cheers Link to comment Share on other sites More sharing options...
justsomeguy Posted July 16, 2009 Share Posted July 16, 2009 Here's a Javascript function to send an email using CDO.Message. If you want to find other examples, or VBscript examples, do a search for CDO message. There should be several examples. This one sends email using a certain SMTP server, so you'll need to know which SMTP server to use. Again, this uses Javascript in ASP, not VBscript. function send_email_func (to, from, subject, body){ mailobj = Server.CreateObject("CDO.Message"); mailobj.From = from; mailobj.To = to; mailobj.Subject = subject; mailobj.TextBody = body; mailobj.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1; mailobj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.domain.com"; mailobj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25; mailobj.Configuration.Fields.Update(); mailobj.Send(); delete mailobj;} However, none of this is going to matter if your server isn't executing ASP code. What code did you run to see if the server supports it? Link to comment Share on other sites More sharing options...
mal100 Posted July 16, 2009 Author Share Posted July 16, 2009 <%Response.Write("Hello Me")%> from http://www.tizag.com/aspTutorial/aspFirstScript.php Link to comment Share on other sites More sharing options...
justsomeguy Posted July 16, 2009 Share Posted July 16, 2009 If that worked, then try this to send your email. Just make sure to fill in the smtp server to use and your email, you might need to ask your host about the mail server. ASP has several ways to send email, so your host might even have a different way they prefer people to use. You can always just run this as-is and see what happens, worst case you would get an error that it couldn't contact the mail server. <%@LANGUAGE="Javascript"%><%var to = "you@gmail.com";var subject = "test email";var from = "you@domain.com";var msg = "Name: " + Request.QueryString("name") + "\nAge: " + Request.QueryString("age");send_email_func(to, from, subject, msg);Response.Write("done");function send_email_func (to, from, subject, body){ mailobj = Server.CreateObject("CDO.Message"); mailobj.From = from; mailobj.To = to; mailobj.Subject = subject; mailobj.TextBody = body; mailobj.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1; mailobj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.domain.com"; mailobj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25; mailobj.Configuration.Fields.Update(); mailobj.Send(); delete mailobj;}%> Link to comment Share on other sites More sharing options...
mal100 Posted July 16, 2009 Author Share Posted July 16, 2009 im basically trying to get this html form sent to a specified email so if anyone has the code or do it for me or even point me in the right direction that would be awsome the only thing is my servers support ASP thanks again <html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>name</title></head><body><h1>Problem Report</h1><script type="text/vbscript">document.write(date())document.write("<br />")document.write(time())</script><form name="input" action="html_form_submit.asp" method="get"></form> Full Name:<br><INPUT NAME=realname><BR> Contact Number:<br><INPUT NAME=email><BR> Problem:<br/> <select name="problems"> <option value="1">Cap</option> <option value="2">Hardware</option> <option value="3">Software</option> <option value="4">Other</option> </select> <br/> <br/> <input type="submit" value="Submit" /></FORM></body></html> Link to comment Share on other sites More sharing options...
justsomeguy Posted July 16, 2009 Share Posted July 16, 2009 We posted at the same time, check above in case you missed it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.