Form to mail: Bamboo SMTP(.asp)

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. 




Google






   



MSN Nick Name



More Resources...





Most Viewed Services:
  1. HTML Tutorial
  2. XHTML Tutorial
  3. CSS Tutorial
  4. Javascript Tutorial
  5. DHTML Tutorial
  6. VB Script
  7. TCP/IP Tutorial
  8. ADO Tutorial
  9. MYSQL Tutorial
  10. ASP Tutorial
  11. AJAX Tutorial
  12. CFML Tutorial
  13. PHP Tutorial
  14. WML Tutorial
  15. FLASH Tutorial
  16. XML Tutorial
  17. RSS Tutorial
  18. SQL Tutorial
  19. HTML Articles
  1. Javascript Articles
  2. PHP Articles
  3. SEO Articles
  4. Web Design Articles
  5. SEO Tips
  6. Web Design Tips
  7. Articles
  8. CSS
  9. CSS Tips
  10. HTML Tips
  11. JAVASCRIPT Tips
  12. MYSQL Tips
  13. PHP Tips
  14. Money
  15. Tutorials
  16. Web Hosting



  • Home
  • Web Directory
  • Top Directoriers
  • Webmaster Directories
  • Contact
  • © Copyright 2006-2010 All Rights Reserved By CodeDcode.Com : HTML : RSS : TEXT : XML