Search
Register |  Sign In |  Sitemap |  Home Techvalley Host
 

 

Techvalley Host
Techvalley Host
Techvalley Host
 
 
To use ASPMail you will need to create 2 pages: a form page and an action page.
The form page, form.html in this example, will contain a standard html form. The initial form tag should look similar to the following:


The action page, aspmailform.asp in this example, will contain the ASPMail script.
<% 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
%>

* If you are using a web builder like Frontpage you will need to enter the ASP code in HTML view



Order your ASPMail Fields:
To return form contents in the original form order your code might be...
strMsgHeader = "Form Information Follows: " & vbCrLf
for i = 1 to Request.Form.Count
strMsgInfo = strMsgInfo & Request.Form.Key(i) & " - " & Request.Form.Item(i) & vbCrLf
next
strMsgFooter = vbCrLf & "End of form information"
Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter
Note this code only works for forms containing 128 or fewer field items

Sending HTML Emails
To send the body of the email as HTML include this line:
Mailer.ContentType = "text/html"
* This line would need to go above the line:
if Mailer.SendMail then

ASPQMail
AspQMail uses the AspMail component to send messages to the queue. To use the component you use it the same way you normally would except that you set one additional property.
Mailer.QMessage = true
*If QMessage is true then the message will be sent to the \Que directory and queued for delivery. If it is false (the default) it will be sent normally via SMTP. Queuing can greatly increase the response time of your application if you are delivering to several recipients at once.
The pertinent lines of this code are explained below:
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Do not alter this line
Mailer.FromName = "website"
Optional, this text will appear in the "from" field on the Email message that is sent. You may use an Email address here.
Mailer.FromAddress = "webmaster@yourdomain.com"
Required: a valid Email address from your domain.
Mailer.RemoteHost = "mail.yourdomain.com"
Required: Enter the address of the mail server for your domain.
Mailer.AddRecipient "Domain Webmaster", "webmaster@yourdomain.com"
Required: and in two parts. The first part ("Domain Webmaster") can be any name or an Email address. The second part ("webmaster@yourdomain.com") must be a valid Email address.
Mailer.Subject = "Form Submission"
This will be the title of your Email message.
Do not alter any other line of the code.



Techvalley Host Privacy Policy   |  Terms and Conditions
Website created and maintained by NSNA - a Bellingham Web Design company. Copyright © 2008 All Rights Reserved.