PDA

View Full Version : What's wrong with this ASP code?


mosidesign
03-11-2003, 06:56 AM
<html>
<head>
<title>ASPMail</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<%
Sub Write(strWriteThis)
'This subroutine just writes out whatever is
'passed to it.
response.write(strWriteThis & "<br>")
end sub

%>


<body>
<%
FirstName = Request.form("FirstName")
LastName = Request.form("LastName")
Email = Request.form("Email")
WorkPhone = Request.form ("WorkPhone")
Company = Request.form("CompanyName")
Address = Request.form("Address")
City = Request.form("CityName")
State = Request.form("State")
ZipCode = Request.form("ZipCode")

strName = "Contact"
strEmail = "[email protected]"

strBody = WorkPhone & Company & Address & City & State & ZipCode

Set Mailer = Server.CreateObject("pop.registeredsite.com")
Mailer.RemoteHost = "mailhub.registeredsite.com"
Mailer.Company = CompanyName
Mailer.Address = Address
Mailer.AddRecipient strName, strEmail
Mailer.LastName = (strLastName)
Mailer.FirstName = (strFirstName)
Mailer.WorkPhone = strWorkPhone
Mailer.City = strCity
Mailer.State = strState
Mailer.State = strZipCode


end if
%>


</body>
</html>:confused:

NRudd
03-11-2003, 07:55 AM
What error are you getting? The code seems to be ok apart from that you are specifying Mailer.State twice.

Mailer.State = strState
Mailer.State = strZipCode

mosidesign
03-11-2003, 02:36 PM
Yo, it's not doing anything. There is no mail going to the box.

NRudd
03-11-2003, 02:48 PM
I just ran the code on my machine and generated 2 errors.

Line 46: end if with no If...Then

Once I removed this, I received

Server object, ASP 0177 (0x800401F3) Invalid ProgID. For additional information specific to this message please visit the Microsoft Online Support site located at: http://www.microsoft.com/contentredirect.asp. line 33

To send emails, you will require an email component which will need to be installed on the server hosting your ASP files. You can use CDONTS but I find ASPEmail (http://www.aspemail.com) alot easier to use.

mosidesign
03-13-2003, 08:44 AM
<%@ LANGUAGE="VBSCRIPT" %>
<html>
<head>
<title>CDONTSMail</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<%
Sub Write(strWriteThis)
'This subroutine just writes out whatever is
'passed to it.
response.write(strWriteThis & "<br>")
end sub

%>
<body>
<%
Dim myCDONTSMail
Dim strCompanyName
Dim strLastName
Dim strFirstName
Dim strEmail
Dim strWorkPhone
Dim strAddress
Dim strCity
Dim strState
Dim strZipCode
Dim lngImportance

Company = Request.form("CompanyName")
FirstName = Request.form("FirstName")
LastName = Request.form("LastName")
Email = Request.form("Email")
WorkPhone = Request.form ("WorkPhone")
Address = Request.form("Address")
City = Request.form("CityName")
State = Request.form("State")
ZipCode = Request.form("ZipCode")

strName = "Contact"
strEmail = "[email protected]"

strBody = WorkPhone & Company & Address & City & State & ZipCode

Set My CDONTSMail = CreateObject("CDONTS.NewMail")
objNewMail.RemoteHost = "mail.registeredsite.com"
objNewMail.Company = strCompanyName
objNewMail.LastName = strLastName
objNewMail.FirstName = strFirstName
objNewMail.WorkPhone = strWorkPhone
objNewMail.WorkPhone = strEmail
objNewMail.WorkPhone = strAddress
objNewMail.City = strCity
objNewMail.State = strState
objNewMail.ZipCode = strZipCode


%>
</body>
</html>



I'm tryin' to get a good idea how this thing works
also here is my flash script:

on (release) {
if (CompanyName ne "" & LastName ne"" & FirstName ne"" & Email ne"" & WorkPhone ne"" & Address ne"" & City ne"" & State ne"" & ZipCode) {
loadVariablesNum ("ASPMail.asp", 0, "POST");
stop ();
}
}

NRudd
03-14-2003, 07:44 AM
Try this link (http://www.asphole.com/StoriesRead.ASP?ID=27)