View Full Version : ASP Contact Form
Tjobbe
February 12th, 2008, 12:18
Hey everyone,
I have a client who's needs stipulate they remain on their existing Windows based server that does not have PHP support, only ASP.
I have *never* worked with ASP before, and so I'm a bit lost as to what to do.
Does anyone have an easy to use pre-made script lying around that they can use or know of a site Where I can find one I can simply copy and paste?
Time limitations mean that I can't really afford to spend x amount of hours researching for the right script and learning some ASP, and I'll only really do it if I really have to, so this is my last resort -- if no-one has one to hand then I'll have to dive in and find one the hard way - I've already done some searching and found some scripts, but I've no idea of what it is I'm looking at as I'm so alien to ASP!
Thanks in advance.. Sorry for being so lazy.
Corey Bryant
February 12th, 2008, 17:49
Can you use the JMail Email Component? If so Processing the Form with the JMail EMail Component (http://www.loudexpressions.com/2007/09/processing-the-form-with-the-jmail-email-component). Most of the other components (CDOSYS, ASPMail, ASPEmail, etc) are pretty much the same.
grandpafred
February 12th, 2008, 18:13
I've got some you can have if you want...one example here
rssasoccer.org/contact.asp
I've got ones that work with jmail and aspmail
Tjobbe
March 12th, 2008, 17:00
Can you use the JMail Email Component? If so Processing the Form with the JMail EMail Component (http://www.loudexpressions.com/2007/09/processing-the-form-with-the-jmail-email-component). Most of the other components (CDOSYS, ASPMail, ASPEmail, etc) are pretty much the same.
I have no idea Corey, I've actually never used ASP or any of those things you just mentioned!
I've got some you can have if you want...one example here
rssasoccer.org/contact.asp
I've got ones that work with jmail and aspmail
If you have one that is fairly simple to just copy and paste I'd love to have one if you could spare the time, thanks!
Thanks to both of you for replying by the way. It's a while ago now but the client got sick and the project was on hold for a while.
Corey Bryant
March 12th, 2008, 19:45
I just noticed my text example actually it "processed" and not shown so I need to get the server admin to help with that. But here is an example
<!-- before the DOCTYPE and <head> -->
<%
Dim Namename,Name,EMailname,EMail
Dim IPname,IP,User_Agentname,User_Agent
Namename = "Name: "
Name = Request.Form("Name")
EMailname = "E-Mail Address: "
EMail = Request.Form("EMail")
Dim Messagename,Message
Messagename = "Message: "
Message = Request.Form("Message")
IPname = "IP Address: "
IP = Request.Form("IP")
User_Agentname = "Browser Info: "
User_Agent = Request.Form("User_Agent")
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "smtp.example.com:25"
JMail.AddRecipient "crb@example.com"
JMail.Sender = Request.Form("EMail")
JMail.SenderName = Request.Form("Name")
JMail.Subject = "Your Subject"
Dim strbody
strbody=strbody & Namename & Name & vbcrlf
strbody=strbody & EMailname & EMail & vbcrlf
strbody=strbody & Messagename & Message & vbcrlf
strbody=strbody & vbcrlf
strbody=strbody & IPname & IP & vbcrlf
strbody=strbody & User_Agentname & User_Agent & vbcrlf
JMail.Body = strbody
JMail.Execute
%>
<!-- Place the code below in the <body> element where you want the form -->
Thank you <%Response.Write(Name)%> for contact us. We will be in contact soon.
Most of it is the same (on the component used)
Tjobbe
March 20th, 2008, 15:56
I just noticed my text example actually it "processed" and not shown so I need to get the server admin to help with that. But here is an example
<!-- before the DOCTYPE and <head> -->
<%
Dim Namename,Name,EMailname,EMail
Dim IPname,IP,User_Agentname,User_Agent
Namename = "Name: "
Name = Request.Form("Name")
EMailname = "E-Mail Address: "
EMail = Request.Form("EMail")
Dim Messagename,Message
Messagename = "Message: "
Message = Request.Form("Message")
IPname = "IP Address: "
IP = Request.Form("IP")
User_Agentname = "Browser Info: "
User_Agent = Request.Form("User_Agent")
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "smtp.example.com:25"
JMail.AddRecipient "crb@example.com"
JMail.Sender = Request.Form("EMail")
JMail.SenderName = Request.Form("Name")
JMail.Subject = "Your Subject"
Dim strbody
strbody=strbody & Namename & Name & vbcrlf
strbody=strbody & EMailname & EMail & vbcrlf
strbody=strbody & Messagename & Message & vbcrlf
strbody=strbody & vbcrlf
strbody=strbody & IPname & IP & vbcrlf
strbody=strbody & User_Agentname & User_Agent & vbcrlf
JMail.Body = strbody
JMail.Execute
%>
<!-- Place the code below in the <body> element where you want the form -->
Thank you <%Response.Write(Name)%> for contact us. We will be in contact soon.
Most of it is the same (on the component used)
Thanks so much Corey.
I'm not sure how to implement this, I've copied and pasted it, but when doing this here: http://www.meylercoaching.co.uk/index-.asp it all goes titis upus!
Is the code you gave me a confirmation page? What form would go with it?
Sorry for the ignorance, I really meant it when I said I know nothing about asp!
heres what i have:
<%
Dim Namename,Name,EMailname,EMail
Dim IPname,IP,User_Agentname,User_Agent
Namename = "Name: "
Name = Request.Form("Name")
EMailname = "E-Mail Address: "
EMail = Request.Form("EMail")
Dim Messagename,Message
Messagename = "Message: "
Message = Request.Form("Message")
IPname = "IP Address: "
IP = Request.Form("IP")
User_Agentname = "Browser Info: "
User_Agent = Request.Form("User_Agent")
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "smtp.example.com:25"
JMail.AddRecipient "crb@example.com"
JMail.Sender = Request.Form("EMail")
JMail.SenderName = Request.Form("Name")
JMail.Subject = "Your Subject"
Dim strbody
strbody=strbody & Namename & Name & vbcrlf
strbody=strbody & EMailname & EMail & vbcrlf
strbody=strbody & Messagename & Message & vbcrlf
strbody=strbody & vbcrlf
strbody=strbody & IPname & IP & vbcrlf
strbody=strbody & User_Agentname & User_Agent & vbcrlf
JMail.Body = strbody
JMail.Execute
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Meyler Coaching: Contact</title>
<link rel="stylesheet" type="text/css" href="../../css/style.css" />
</head>
<body id="contact">
<div id="all">
<?php include "../../includes/header.php" ;?>
<!--div id="intro">
<h2>blank</h2>
</div-->
<div id="content">
<h1>Supervision for trained and practising coaches</h1>
<p>Thank you <%Response.Write(Name)%> for contact us. We will be in contact soon.</p>
</div>
</div>
</body>
</html>
Corey Bryant
March 20th, 2008, 18:32
Yes that is the code that goes into the confirm.asp page. Here is the example of the "form" that I used <!-- in the <head> -->
<!-- Cascading Style Sheet -->
<style type="text/css">
label,input {
display: block;
float: left;
margin-bottom: 10px;
}
input, select, textarea
{
border: solid 1px #000;
background-color: #fff;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 1.0em;
}
label {
text-align: right;
width: 125px;
padding-right: 20px;
}
br {
clear: left;
}
</style>
<! -- End of CSS -->
<!-- Place the code below in the <body> element where you want the form -->
<fieldset>
<legend style="border: 2px solid green;">Information</legend>
<form method="post" action="confirm.asp">
<input type="hidden" name="IP" value="<%Response.Write(Request.ServerVariables("remote_addr"))%>" />
<input type="hidden" name="User_Agent" value="<%Response.Write(Request.ServerVariables("http_user_agent"))%>" />
<br />
<label for="name">Name</label><input id="name" name="name" /><br />
<label for="email">E-Mail</label><input id="EMail" name="EMail" /><br />
<label for="Message">Message</label><textarea rows="2" name="Message" id="Message" cols="20"></textarea><br />
<p style="padding-left: 125px"><input type="submit" value="Submit" name="submit" /></p>
</form>
</fieldset> You will see the corresponding IP, User_Agent, name, Email, Message in the form.
And then the other code goes into your confirm.asp.
Sorry it took so long to respond - I was trying to find my ASP page that checked email components.
Tjobbe
March 20th, 2008, 18:42
Thanks Corey, looks good now, just need to find out the "JMail.ServerAddress" and I guess I'm ready to go once I have set the recipient?
Corey Bryant
March 20th, 2008, 18:59
JMail.ServerAddress should be your email server (mail.example.com).
If your server requires SMTP authentication, you might need to add some other fields as well. Usually most email servers will whitelist the www server to bypass SMTP authentication
Corey Bryant
March 20th, 2008, 19:10
And just in case, if you do need to enter a username / password, add
Message.MailServerUserName = "myUserName"
Message.MailServerPassword = "myPassword"
right after Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "smtp.example.com:25"
so that you have
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "smtp.example.com:25"
Message.MailServerUserName = "myUserName"
Message.MailServerPassword = "myPassword"and that should work.
(Even though it won't be shown in the browser, you might want to create a specific username / password for this just in case.)
Tjobbe
March 20th, 2008, 19:42
Thanks so much for this Corey, one more thing though, if you don't mind.
I have used your username and password, and uploaded the files, but upon submitting I get the following:
Microsoft VBScript runtime error '800a01a8'
Object required: 'testing testing test'
/thanks.asp, line 18
Any ideas?
Corey Bryant
March 20th, 2008, 23:08
Sorry - had to make a few errands and such a warm / hot day, took the dog to the park.
If you are referring to Message.MailServerUserName = "myUserName"
Message.MailServerPassword = "myPassword"that's only needed if SMTP authentication is required by your email server.
Tjobbe
March 20th, 2008, 23:16
Sorry - had to make a few errands and such a warm / hot day, took the dog to the park.
If you are referring to Message.MailServerUserName = "myUserName"
Message.MailServerPassword = "myPassword"that's only needed if SMTP authentication is required by your email server.
Never apologise for taking time to help out, thanks for checking back Corey!
The server does require authentication,a dn having spoken to tech support (now closed!) they provided me with the details required for those two fields.
Issue now is that error message I'm getting that is also showing what I entered into the comments field, do you have any ideas as to why that is happening?
Corey Bryant
March 21st, 2008, 01:22
(Just did not want the others to think I was ignoring Tjobbe, I asked him for the complete source code to test it. I'll post what I think was the problem once we get through a couple things.)
vBulletin® v3.6.8, Copyright ©2000-2012, Jelsoft Enterprises Ltd.