Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


vbscript form email help

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,25470
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> vbscript form email help
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 vbscript form email help - 9/1/2005 6:01:01 PM   
  yabyuh

 

Posts: 1
Score: 0
Joined: 9/1/2005
Status: offline
im seriously stuck and lost and going gaga

im trying to create a feedback form that would sent to an email.



<form method="post" name="frmFeedback" action="mailto:test@gmail.com" enctype="text/plain">
Name: <input type="text" name="txtFirstname" size="28"><br><br>
Feedback Information: <br><br>
<textarea name="txtFeedback" cols=48 rows=4></textarea>
<input type="submit" value="Submit Feedback" name = "btnLogin" onClick = "Feedback()"> <input type="Reset" value="Clear Form">




<script language="VBScript">
function Feedback()
dim strName, strFeedback

strName = document.frmFeedback.txtName.value
strFeedback = document.frmFeedback.txtFeedback.value

end function
</script>

i dont know where to go from here.

 
 
Post #: 1
 
 RE: vbscript form email help - 9/2/2005 1:42:05 AM   
  thantos_kalev2001


Posts: 26
Score: 0
Joined: 8/31/2005
Status: offline
You could use something like this:

<html>
<head>
<script language = "vbscript">
sub cmdSubmitForm_OnClick()

 
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Form Feedback from " & form1.txtName.value
objMessage.Sender = "
test@gmail.com"
objMessage.To = "
test@gmail.com"

objMessage.TextBody = "Form Summary: " & form1.txtFeedback.value

objMessage.Configuration.Fields.Item _
("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'SMTP Name or IP
objMessage.Configuration.Fields.Item _
("
http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp_mail_server_name_here"
'Server port (usually 25)
objMessage.Configuration.Fields.Item _
("
http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Port 25 is default, but you might have to enter another port number
'****Option to add attachment
objMessage.Configuration.Fields.Update

objMessage.Send

   msgbox"Success!"
end sub
</script>
</head>
<BODY>
<form name = "form1" method = "post">
<table border="1">
<tr>
<td>Name:</td><td><input type = "text"name = "txtName"></td>
</tr>
<tr>
<td>Message:</td><td><input type = "text" name = "txtFeedback" size="100"></td>
</tr>
<tr>
<td><input type = "button" name = "cmdSubmitForm" value = "Submit"></td>
</tr>
</table>
</form>
</body>
</html>

 
Just save this as a .asp file and take a look at it in Internet Explorer.  You will also have to add your smtp server name in the space specified, and you might have to change the smtp port number.  Also, put in the email address that you want to send to. 
I tested it and it does work.

I hope this helps!

Thantos

(in reply to yabyuh)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> vbscript form email help Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts