|
Sending an e-mail from a Web page using the SpicePack mail component (Chili!Mail) bundled with Sun ONE Active Server Pages: 1.) Make sure that the Chili!Mail component is enabled for your install of Sun ONE Active Server Pages. Enabling the Chili!Mail component can be done from the Sun ONE ASP Administration Console by clicking the Components link and enabling the Chili!Mail component.
Clicking Components takes you to a screen from which you can enable individual components. Select the check box next to Chili!Mail.
Click Save, and the Chili!Mail component is then ready for use on your ASP server. 2.) In your ASP code use Server.CreateObject to create a mail object that references the ChiliMail component. This process is almost identical to creating a CDONTS mail object with IIS and Microsoft ASP: Server.CreateObject("CDONTS.NewMail") 3.) Write the ASP code that generates the body text, e-mail recipicients, and subject line for your e-mail output. The ChiliMail component has a standard set of methods including Host, Body, To, and From. Your ASP code can pass the body text, recipients, and subject line to the recently created mail object. 4.) Call the Chili!Mail server object and complete the e-mail with the Send method. Your e-mail will be generated and then sent. Below is an ASP code sample that demonstrates the major elements of sending e-mail with ASP and the Chili!Mail component. Comment text is green: ################# Begin ASP Chili!Mail Sample Code ####################### <%@LANGUAGE="VBSCRIPT" %> <% Option Explicit %> 'Declare your variables 'Create the mail object 'Define your variables strTo = "foo@foowebsite.com" 'Use the mail object methods and your
ASP variables to generate and send e-mail. 'It is always a good idea to destroy
your server objects once you are done with them, to preserve resources. ################# End ASP Email Sample Code ####################### You have now completed this How To... topic. Click here to select another topic. |
|
| ||||||||||||