|
Example 1
Would you like to get on your email all the information included in
a form?
- First of all you need a form, as for example the one in the table:
| form.html
|
|
<FORM ACTION="formtomail.asp"
METHOD=post>
<!-- Your fields here -->
<INPUT TYPE=submit value="Submit">
</FORM>
|
The Form Action must be directed to the ASP script bellow.
-
Second: you need the asp script (copy the information in the table to a
text file
and save the file as "formtomail.asp" in your server).
| formtomail.asp
|
<%
For Each x In Request.Form
message = message & x & ": " & Request.Form(x)
& CHR(10)
Next
set smtp=Server.CreateObject("Bamboo.SMTP")
smtp.Server="mail.yourdomain.com"
smtp.Rcpt="youremail@yourdomain.com"
smtp.From="formtomail@yourdomain.com"
smtp.FromName="Joe Smith"
smtp.Subject="Response to my form"
smtp.Message = message
on error resume next
smtp.Send
if err then
response.Write err.Description
else
Response.redirect ("http:// redirect.com")
end if
set smtp = Nothing
%>
|
You need to customize the script:
-
You need to put your smtp sever name (for example: mail.yourdomain.com).
You may also write your IP address instead.
-
Change youremail@yourdomain.com, and
write the email to which you want the information to be send.
-
Instead of formtomail@yourdomain.com,
write the email from which the information is send.
In case you are asking to your visitor to write their email in the
form (p.e. using a field like this: <input type="text" name="email">,
you may write "request.for("email")" instead of "formtomail@yourdomain.com".That
way you will get un email from the person filling the form.
-
"Joe Smith" will be the name of the sender.
You may write "request.form("yourname")" if
you are asking your visitors their name in a specific field (p.e., <input
type="text" name="yourname">.
-
"Response to my form" will be the subject
of the email you will get.
-
This script will redirect the response to a different page. Whatever you
want to unswer to the person who has fill the form must be writen in a
html page. Write this url in the script (change "http://
redirect.com").
NOTE: You may have problems with this script in your server in case "Bamboo.SMTP"
instruction is not supported by your server. In that case you will need
a different script.
|