How to send Auto Responder from your website?


If you want to improve your website a feed back form from the user will be of utmost useful. This program gives you the ability to send an auto responder message for the feed back received from the user.

step 1:- Create an HTML page to grab the information from the user and name it as feedback.html

<HTML>
<HEAD>
<TITLE>Feedback Form</TITLE>
</HEAD>
<BODY bgCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" vLINK="#0000AA" aLINK="#000000">

<FORM ACTION="form_processor.asp" METHOD="POST">
<P>Feedback Form<BR></P>
<P>Name: (required)<BR><INPUT TYPE="TEXT" NAME="Name" SIZE="40" MAXLENGTH="100"></P>
<P>EMail: (required)<BR><INPUT TYPE="TEXT" NAME="EMail" SIZE="40" MAXLENGTH="255"></P>
<P>Feedback Message: (required)<BR><TEXTAREA NAME="Message" ROWS="10" COLS="70">
</TEXTAREA></P>
<P>&nbsp;</P>
<INPUT TYPE="SUBMIT" NAME="SUBMIT" Value="Send Feedback!">
</FORM>

</BODY>
</HTML>



2. Now open your favorite editor copy and paste the below code in it and save it as form_processor.asp

<HTML>
<HEAD>
<TITLE>Feedback Status</TITLE>
</HEAD>

<BODY bgCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" vLINK="#0000AA" aLINK="#000000">

<%

' The location of the text file containing the data for
' the auto-response message.
Filename = "<please insert the path>\auto_response.txt"

' This script checks for information in required
' form variables, trims the spaces from the information
' that was entered, sends the feedback message,
' and sends the visitor an auto-response message
' that is read from a text file.


' Retrieve the information the user entered and
' store it in variables.
reqName = Trim(Request.Form("Name"))
reqEMail = Trim(Request.Form("EMail"))
reqMessage = Trim(Request.Form("Message"))


' Check for required information and provide
' the visitor with an error message if a required
' field was left blank.
If reqName = "" OR reqEMail = "" OR reqMessage = "" Then
' Not all required information was
' entered. Provide the visitor with an error
' message
%> 
<b>Error!</b><br>
<br>
You must enter information for all of the required
fields. 
<%
Else
' Sufficient information was entered.
'
' Proceed.


' Provide ASPEMail with the information it needs
' to send the feedback message.
Set oMail = Server.CreateObject("CDONTS.newmail") 
'oMail.ishtml= False
'oMail.Host = "www.developeriq.com"
'oMail.FromName = reqName
oMail.From = reqEMail
oMail.To = "prasad@iqresearch.net"
oMail.Subject = "Website Feedback"
oMail.Body = "This feedback message was sent from your website:" & VBCrLf & VBCrLf & reqMessage

' Send the feedback now & check for
' errors.
On Error Resume Next
oMail.Send()
If Err = 0 Then
' The email was successfully sent.
' Show the visitor a thank you message.
%>
<b>Thank you!</b><br>
<br>
Your feedback has been sent.
<%
Else
' The email was not sent. Show the
' visitor an error message.
%>
<b>Error!</b><br>
<br>
An error occured while sending your feedback. Please try again later.
<%
End If


' We are now ready to send the auto-response
' message. In order to do so, we must first retrieve
' the information that will be used in the auto-response
' message from a text file. Once we have done so we will
' send the email message.

' Check if the file exists. If the file exists we
' will continue, otherwise we will simply end the program
' here and not bother sending an auto-response message.
Set oFS = Server.CreateObject("Scripting.FileSystemObject")
If oFS.FileExists(Filename) Then
' The file exists. Retrieve the information
' from it.
Set oTS = oFS.OpenTextFile(Filename) 
FromName = oTS.ReadLine
FromAddress = oTS.ReadLine
Subject = oTS.ReadLine
While NOT oTS.AtEndOfStream
Message = Message & VBCrLf & oTS.ReadLine
Wend
oTS.Close 
Set oTS = Nothing

' Send the auto-response message.
'oMail.FromName = FromName
oMail.From = FromAddress
oMail.Subject = Subject
oMail.To = reqEMail
oMail.Body = Message 
oMail.Send()
End If
Set oFS = Nothing

' Free the memory used by the email
' component.
Set oMail = Nothing
End If
%>

</BODY>
</HTML>


3. create a .txt file with the following information and name it as auto_response.txt


Developeriq Resources
kishore@iqresearch.net
Feedback Received
Thank you for sending your feedback to us via
http://www.developeriq.com/feedback/

A staff member will review your feedback shortly
and be in touch with you.

Thank you for your interest in Website Resources.

That is all you have to do.




Added on June 22, 2007 Comment
}