WebSpiders Interweb Pvt. Ltd.
Please Login or Register

Knowledgebase

 Using the ASPMail component to send mail from your web page
Solution
#Using the ASPMail script is a very straightforward process. All you need do is specify a page on your web site as the "action" page for your form, and then include the ASPMail script on that page.

Each form on your website will consist of 2 pages: A "form" page which actually holds your form, and an "action" page which processes your form when someone clicks on the "submit" button. For purposes of this discussion, we will refer to these pages as "form.html" and "aspmailform.asp".

*Note: Your action page must have a .asp extension, even though it is an ordinary HTML file.

Once you have constructed your form using regular HTML make sure that your <form>tag specifies the "post" method, and that the action statement points to your "action" page. Example:

<form action="aspmailform.asp" method="post">

Then, on your action page (aspmailform.asp) you will need to add a block of code similar to the one below. The Mailer.RemoteHost line will be "mail.yourdomain.xyz" (where .xyz is your domain extension such as .com). Please note that your domain must be pointing to our service and you must be using our DNS servers for this to work properly.

<%
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")

Mailer.FromName = "WebsiteOrAnything"
Mailer.FromAddress= "name@yourdomain.com"
Mailer.RemoteHost = "mail.yourdomain.com"
Mailer.AddRecipient "Name", "name@yourdomain.com"
Mailer.Subject = "Form Submission"
strMsgHeader = "Form information follows" & vbCrLf

for each qryItem in Request.Form
   strMsgInfo = strMsgInfo & qryItem & " - " & request.Form(qryItem) & vbCrLf
next

strMsgFooter = vbCrLf & "End of form information"

Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter

if Mailer.SendMail then
   Response.Write "Form information submitted..."
else
   Response.Write "Mail send failure. Error was " & Mailer.Response
end if
%>
 


Article Details
Article ID: 45
Created On: 15 Jul 2005 08:51 AM

 This answer was helpful  This answer was not helpful

 Back

Help Desk Software By Kayako SupportSuite v3.70.02
Language:

Quick Navigation

Client Login

Email

Password

Remember Me

Search