View Full Version : Why isn't this working?
wisemx
01-23-2007, 01:36 AM
You posted this in the asp.net section but that's ASP code.
Use this Google Microsoft link to search for tons of examples on ASP CDO MAIL
http://www.google.com/microsoft.html
bruce
01-23-2007, 06:41 AM
See this KB article, http://kb.discountasp.net/article.aspx?id=10078
The sample code should help.
Bruce
DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)
deacon
01-23-2007, 10:36 AM
I am a noob that wanted to use an email form on my webpage, so i got a already made script from the internet.
But it's not working on discountasp.net, i tried on other server and worked well.
Can you guys help me^?
The code is this :
[b]
<%@language="VBScript"% ('%@language="VBScript"%')>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Simple ASP E-mail Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
[b]<!-- Beginning of ASP Form-Handler Script -->
<%
'Check for required fields
If (Request.form("user_email") <> "" and Request.form("user_subject") <> "" and Request.form("question") <> "") then
'Declare variables for the form input fields and the e-mail
dim strAddr, replyTo, strSubject, strName
dim strMsg, strDeptPhone, strPerspective
dim strClassAssignment, strTermPaper
dim strText
'Get input from the form and assign it to script variables
strAddr = Trim(Request.form("user_email"))
if strAddr <> "" then
replyTo = cstr(strAddr)
end if
strSubject = Request.form("user_subject")
strName = Request.form("user_name")
strMsg = Request.form("question")
strDeptPhone = Request.form("dept_phone")
strPerspective = Request.form("perspective")
strClassAssignment = Request.form("class_assignment")
strTermPaper = Request.form("term_paper")
strText = "E-mail from: " & strName & vbCrLf &_
"Concerning: " & strMsg & vbCrLf & vbCrLf &_
"Dept. Phone: " & strDeptPhone & vbCrLf &_
"Perspective: " & strPerspective & vbCrLf &_
"Class Assignment: " & strClassAssignment & vbCrLf & "Term Paper: " & strTermPaper & vbCrLf & "."
'Note: use vbCrLf (as above) to add line breaks in the e-mail message
send_email()
else
'We are here because user has not filled out required fields
'Send user back to form
response.redirect("emailform2.html")
end if
'The send_email function formats and sends the e-mail
function send_email()
'Create an object or container for your mail
Dim objMail
Set objMail = Server.CreateObject("CDO.Message")
strSubject = strSubject
'Format the e-mail using fields from your HTML form
objMail.To = "info@mail.net"
objMail.From = "visitor@whatever.com" 'Generic address is a cue about origin
objMail.ReplyTo = replyTo
objMail.Subject = strSubject
objMail.TextBody = strText
objMail.Send
Set objMail= Nothing
if err.number > 0 then
response.write "Errors were encountered in sending your e-mail message. "&_
"Please try again, or contact the <a href='mailto:you@whatever.com'>webmaster</a>"
else
'reformat strMsg to preserve line breaks in the question textarea
strMsg = replace(strMsg,vbcrlf,"[b]")
response.write "<h3>Thank you for using our e-mail form!</h3>[b]" &_
"Your information was submitted as follows:[b]" &_
"Name: " & strName & "[b]" &_
"E-mail Address: " & strAddr & "[b]" &_
"Dept. Phone: " & strDeptPhone & "[b]" &_
"Perspective: " & strPerspective & "[b]" &_
"Class Assignment: " & strClassAssignment & "[b]" &_
"Term Paper: " & strTermPaper & "[b]" &_
"Question: " & strMsg & "[b][b]" &_
"<a href='emailform2.html'>Return to the e-mail form</a>"
end if
end function
%>
<!-- end of form handler script -->
<p>Updated 4 April 2006[b]
Comments to <a href="mailto:you@whatever.com">webmaster</a></p ('you@whatever.com">webmaster</a></p')>
<p>&nbsp;</p>
</body>
</html></BLOCKQUOTE>
[/quote]
Houston Online
02-05-2007, 07:39 AM
That a very bad code that was written by the author, they should test the code first be publishing on the website, some codes do work and most of them are very non fuctional,
perhaps on a website, you should ask the administrator why is that code not working, or it could be a lack of coding expernice the Administrator has written out, I seen most websites with codes like that it can be really annoying, make sure the database is written and read and write - able.
I use ASP for my website, but I never use PHP or cgi, because they are not very secure.http://community.discountasp.net/emoticons/jumpin.gif
Website Address: http://www.houston777network.net
Feel free to have a look, its worth an expernice.
Sir. William Houston
vBulletin® ©Jelsoft Enterprises Ltd.