Results 1 to 2 of 2

Thread: help me pleaseeee!!

Hybrid View

  1. #1
    Join Date
    Feb 2006

    help me pleaseeee!!

    Can someone give me an .asp script that will send the form fields to my e-mail and redirect the viewer to the page saying there message has been sent. I know how to do the ( form action="script.asp" ) but I dont know how to make the asp script.

  2. #2
    Join Date
    Feb 2003
    ok, since you know how to do action="script.asp" then this is what to put in script.asp.

    Comment out the on error resume next while testing
    Response.ExpiresAbsolute = Date()-1
    Dim f
    Dim subject
    Dim body
    Dim strErr
    subject = "A message"
    body = ""
    For Each f in Request.Form
    	body = f & ":" & vbTab & Request.Form(f) & vbCrLf
    If SendMail(subject, body, strErr) Then
    	Response.Write "Mail Sent"
    	Response.Write "Error Sending mail<br>"
    	Response.Write "<span style=color:red>" & strErr & "</span>"
    End If
    Function SendMail(byVal subject, byVal body, byRef strErr)
    	Dim ObjSendMail 
    	Dim iConf 
    	Dim Flds
    	On Error Resume Next
    	Set ObjSendMail = Server.CreateObject("CDO.Message") 
    	Set iConf = Server.CreateObject("CDO.Configuration")
    	Set Flds = iConf.Fields 
    	With Flds 
    		.Item(cdoSendUsingMethod) = 2
    		.Item(cdoSMTPServer) = "Server_Name_Or_IP_address" 
    		.Item(cdoSMTPServerPort) = 25 
    	End With
    	Set ObjSendMail.Configuration = iConf
    	Set ObjSendMail.Configuration = iConf
    	ObjSendMail.To = "you@there.com"
    	ObjSendMail.Subject = "this is the subject"
    	ObjSendMail.From = "me@here.com"
    	' we are sending a text email.. simply switch the comments around to send an html email instead
    	'ObjSendMail.HTMLBody = "this is the body"
    	ObjSendMail.TextBody = "this is the body"
    	SendMail = True
    	Set ObjSendMail = Nothing 
    	Set iConf = Nothing 
    	Set Flds = Nothing
    	If Err.number <> 0 Then
    		strErr = Err.number & " " & Err.Description
    		SendMail = False
    	End If
    	On Error Goto 0
    End Function
    Last edited by russell; 06-16-2006 at 01:58 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center