
AspMail is used on more ASP installations than any other commercial or free product. Used on 1000's of Web sites around the world, this component allows you to send SMTP mail directly from a Web page. AspMail includes support for
AspQMail works just like AspMail except that messages are optionally queued up for delivery using the AspMail component. A companion NT service is notified when messages are added to the queue and attempts delivery while your ASP script is freed from the delay of delivering the message. AspQMail and AspMail provide a unified interface for SMTP messaging. AspQMail allows you to use the queuing mechanism for none, some or all messages. AspQMail Tutorial Availability,
Technical Support and Licensing Availability, Technical Support and Licensing AspQMail is made by ServerObjects Inc. and is fully licensed by Global Webbusiness Internet Publishing Corp. for use on its servers. This component is available to our customers as a standard feature with all plans at no additional cost. Paid scripting support can be obtained by the following sources listed by Server Objects Inc. Inclusion in this listing does not constitute an endorsement or recommendation on the part of Global Webbusiness Internet or ServerObjects Inc. These listings represent responses to requests for information for listings from individuals. We encourage you to evaluate these resources yourself to determine if they can fulfill your development needs. Global Webbusiness or ServerObjects Inc may not be held liable for any loss or damage whatsoever resulting from use or misuse of this list. Consultants are added to this list in the order that information is received. Global Webbusiness Publishing Corp. does not offer scripting support.
Does Global Webbusiness offer a SMTP server? Yes. The SMTP server m1.wipc.net is offered by Global Webbusiness exclusively for our customers for the sole purpose of sending email from web sites hosted by us. Please be advised that this server cannot be utilized by external mail clients for sending mail.
About AspMailAspMail allows you to send mail using the standard SMTP protocol from any program that can use ActiveX/OLE components (such as Active Server Pages scripts). Features include:
About AspQMailAspQMail builds on the success of the AspMail product and provides all the features that AspMail provides and in addition:
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. If it is false (the default) it will be sent normally via SMTP (normal ASPMail mode without queuing). When set to false, the Web client is forced to wait until the SMTP mail transaction is completed adding delays. Setting this property to true alleviates that problem and, additionally, offers the benefit of re-trying the mail message in case of unsuccessful initial delivery.
Simple Mail ExampleUsing the component is as simple as
The following code demonstrates how to use
AspMail from VBScript. Save the code as a .asp file and make sure you
place it in a directory in your site capable of executing ASP. <html> <% </body> By testing the result of the SendMail method we can determine if the mailing process was successful or not.
Form Handling All or partial input for a message may come from a form. For example, a form posted to the server with a request method of GET (i.e. <form action="/scripts/AspMail.asp" method=get>) may provide the message recipient’s email address, subject and message text as follows:
Mailer.AddRecipient Request.QueryString("ToName"), Request.QueryString("ToAddress")
Mailer.Subject = Request.QueryString("Subject")
Mailer.BodyText = Request.QueryString("MsgBody")
The form may also use the POST method (i.e. <form action="/scripts/AspMail.asp" method=post>) in which case the code would look as follows:
Mailer.AddRecipient Request.Form("ToName"), Request.Form("ToAddress")
Mailer.Subject = Request.Form ("Subject")
Mailer.BodyText = Request.Form ("MsgBody")
You can use any mixture of static and dynamic data in setting the components properties as dictated by your needs. For example, you may wish to send the mail to a single user. In this case you could modify the code to look something like this: Mailer.AddRecipient "John Smith", "[email protected]" Mailer.Subject = Request.QueryString("Subject") Mailer.BodyText = Request.QueryString("MsgBody")
Generic Form HandlingIn some cases users may wish to use a number of different forms to send email with the same block of code. ASP allows you to loop through each QueryString or Form variable and append each one to string variable which is then assigned to the BodyText property. Please note: AspMail cannot control the order that these variables are returned in. This is a function of ASP, not AspMail. ASP takes the form variables and creates the appropriate Request collection (QueryString or Form) and stores the data in an order that AspMail cannot change. If you use this method you must accept ASP's order. strMsgHeader = "Form information follows" & vbCrLf for each qryItem in Request.QueryString strMsgInfo = strMsgInfo & qryItem & " - " & request.querystring(qryItem) & vbCrLf next strMsgFooter = vbCrLf & "End of form information" Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter
Setting Mail PriorityThere are a couple of headers that can be modified to set message priority. The Priority property sets the message priority on a scale of 1 to 5. A priority of 1 means HIGH. A priority of 3 means NORMAL and a priority of 5 means LOW. In addition to this you can also set the Urgent property if the message status is urgent. The Urgent property is a true/false property.
How to Use the DateTime PropertyThe component creates a Date/Time value for the message based on the calculated GMT time. The DateTime property was added to allow users to set a custom date/time timezone. The following code demonstrates how to set the DateTime to US Central Standard Time. By slightly altering the code you can adjust this to work for your own timezone. function DayName (intDay) | |||||||
| [set other Mailer
properties] Mailer.DateTime = DayName (WeekDay(Date)) & ", " & Day(Date) & " " & MonthName(Month(Date)) & " " & Year(Date) & " " & FormatDateTime(Now, 4) & " -0600 (CST)" Mailer.SendMail |
Notes About Creating the Mailer ObjectYou can create the mailer object at two different points in time:
You will have to decide when and where it is appropriate to create the object based on your particular application. If you aren't sure which way to create the object reference, or for typical usage, you should create the object immediately before sending your email. Your code would look like this: Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
... [Set properties]
if Mailer.SendMail then ...
Creating these local references, as demonstrated above, allow you to use the object on multiple application threads at the same time. To create an object reference at the session level, your code might look something like this: if Not IsObject (session("Mailer")) then
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Set session("Mailer") = Mailer
else
Response.write "Cached session object reference being used<p>"
Set Mailer = session("Mailer")
end if
Multiple Host SupportAspMail provides one host property to set up remote SMTP server addresses. The RemoteHost property should be set to your primary and secondary server’s address seperated by semicolons. In the event that the primary server is down, AspMail will attempt to use the secondary server. For example, Mailer.RemoteHost = "mailhost.localisp.com;mailhost.anotherisp.com"
PGP SupportAspMail now supports PGP. See the pgpmail.asp script for an example of usage. ServerObjects Inc. is not responsible for PGP support. If you have questions about PGP please contact the developers of PGP.
Sign up | Web
Hosting Plans | Dedicated Hosting | E-Commerce
Copyright © 1999 Global Webbusiness |