Feedback script
Feedback script
Stupid question but my host is using mailenable on their servers and i need to find a simple script for feedback forms on my website. Can anyone share one or point me to a site with mailenable scripts? Any help would be appreciated since I'm kinda new to ASP.
here is my code:
<%
name = request.form("name")
email = request.form("email")
message = request.form("message")
If name="" or email="" or message="" Then
url = "contact.asp?reqd=* indicates required field&name=" & name & "&email=" & email & "&message=" & message
If name="" Then
url = url & "&mname=*"
End if
If email="" Then
url = url & "&memail=*"
End if
If message="" Then
url = url & "&mmessage=*"
End if
response.redirect url & "&foobar=foobar#form"
response.end
End if
Dim oMail ' Email object
Dim strFromName ' From persons' real name
Dim strFromEmail, strToEmail ' Email addresses
Dim strSubject, strBody ' Message
Dim misccompo
strSubject = "ENTER YOUR SUBJECT HERE"
strFromName = Trim(Request.Form("name"))
strFromEmail = Trim(Request.Form("email"))
strToEmail = "melissa8781@hotmail.com"
strBody = Trim(Request.Form("message"))
Set oMail = server.CreateObject("MEMail.Message")
oMail.MailFrom = strFromName & " <" & strFromEmail & ">"
oMail.MailTo = strToEmail
oMail.Subject = strSubject
oMail.MessageBody = "--------------------------------------" & vbcrlf & vbcrlf & strbody & vbcrlf & vbcrlf & vbcrlf & "--------------------------------------------------------------" & vbcrlf & "MESSAGE ENDS: End of message"
oMail.SendMessage
Set oMail = Nothing
response.redirect "thanks.asp"
response.end
%>
<%
name = request.form("name")
email = request.form("email")
message = request.form("message")
If name="" or email="" or message="" Then
url = "contact.asp?reqd=* indicates required field&name=" & name & "&email=" & email & "&message=" & message
If name="" Then
url = url & "&mname=*"
End if
If email="" Then
url = url & "&memail=*"
End if
If message="" Then
url = url & "&mmessage=*"
End if
response.redirect url & "&foobar=foobar#form"
response.end
End if
Dim oMail ' Email object
Dim strFromName ' From persons' real name
Dim strFromEmail, strToEmail ' Email addresses
Dim strSubject, strBody ' Message
Dim misccompo
strSubject = "ENTER YOUR SUBJECT HERE"
strFromName = Trim(Request.Form("name"))
strFromEmail = Trim(Request.Form("email"))
strToEmail = "melissa8781@hotmail.com"
strBody = Trim(Request.Form("message"))
Set oMail = server.CreateObject("MEMail.Message")
oMail.MailFrom = strFromName & " <" & strFromEmail & ">"
oMail.MailTo = strToEmail
oMail.Subject = strSubject
oMail.MessageBody = "--------------------------------------" & vbcrlf & vbcrlf & strbody & vbcrlf & vbcrlf & vbcrlf & "--------------------------------------------------------------" & vbcrlf & "MESSAGE ENDS: End of message"
oMail.SendMessage
Set oMail = Nothing
response.redirect "thanks.asp"
response.end
%>
-
- Posts: 36
- Joined: Mon Nov 03, 2003 9:41 pm
- Contact:
Ironically it appears that ME's own SendMail COM component does not support authentication.
You said your provider disabled CDONTS and JMail. You might want to see if CDOSYS is available. I'm assuming the host is using Windows 2000/2003 server.
Here is sample code to send email using CDOSYS:
You can find more information on MSDN.
http://msdn.microsoft.com/library/en-us ... saging.asp
Kiliman
You said your provider disabled CDONTS and JMail. You might want to see if CDOSYS is available. I'm assuming the host is using Windows 2000/2003 server.
Here is sample code to send email using CDOSYS:
Code: Select all
' Define CDOSYS constants
Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort = 2
Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic = 1
Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"
Dim iMsg
Set iMsg = CreateObject("CDO.Message")
With iMsg.Configuration.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "localhost"
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = "username"
.Item(cdoSendPassword) = "password"
.Update
End With
With iMsg
.To = """User A"" <userA@microsoft.com>"
.From = """User B"" <userB@microsoft.com>"
.Subject = "Hows it going? I've attached a document"
.TextBody = "Hello world!"
.AddAttachment "C:\files\mybook.doc"
.Send
End With
http://msdn.microsoft.com/library/en-us ... saging.asp
Kiliman