Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL
Help

Hour 11. Sending and Receiving Email > Sending Email - Pg. 128

Sending and Receiving Email 128 Figure 11.3. The default domain can be changed to any domain you like. I am presenting these topics at great length here because I have seen many people complain about the complexities of maintaining the SMTP service. With the tasks presented so far, however, you shouldn't run into any configuration problems. Sending Email The SMTP service is up and running and you want to send your first email--what is the fastest way? Take a look at Listing 11.1. Example 11.1. The Fastest Way to Send Email 1: 2: 3: 4: 5: 6: 7: 8: 9: <% @LANGUAGE = VBScript %> <% Option Explicit Dim myMail Set myMail = Server.CreateObject("CDONTS.NewMail") myMail.Send "Webmaster@asp24h.com", "brains@softwing.com", _ "My first mail", "This message is sent to you Chris.", 0 Set myMail = Nothing %> The first notable thing is that an object is created on line 5, which has a ProgId of CDONTS.New- Mail. The NewMail object is part of the Collaboration Data Objects for Windows NT Server (CDONTS), and it allows you to easily send mail via the Send method. It takes the following param- eters: myMail.Send FromAddress, ToAddress, Subject, Body, Importance The parameters are self-explanatory up to the last one, in which the possible values are of interest: 0 for low importance, 1 for normal, and 2 for high importance. Note that the object is explicitly destroyed on line 8 using