The CDONTS Session Object

The Session object is a top-level component used to establish a session with the SMTP server component of IIS. The LogonSMTP method is used to establish a session. This method must be called prior to using any of the other CDONTS Library objects (other than NewMail). Sessions can be terminated using the Logoff method. The following code shows the syntax for logging on to an SMTP session:

<OBJECT RUNAT=server PROGID=CDONTS.Session id=objSession> </OBJECT> <% objSession.LogonSMTP "Nicholas D. Evans", _     "nick.evans@us.pwcglobal.com" %> 

The advantage of using the Session object over the NewMail object is that you have access to richer functionality. The NewMail object is used to send e-mail messages with very few commands. The Session object allows you to gain access to folders, messages, attachments, and recipients within your mail application. This way you have fuller access to the mail within your application. For example, you can delete or send mail, delete attachments, navigate through messages, add or delete recipients, and so on.

The Session object has several properties that you can access within your scripts, including Inbox, Outbox, Application, MessageFormat, Version, and so on. These are all read-only properties except MessageFormat. The Inbox and Outbox properties return Folder objects that represent the current user's Inbox folder and Outbox folder.



Programming Microsoft Visual InterDev 6. 0
Programming Microsoft Visual InterDev 6.0
ISBN: 1572318147
EAN: 2147483647
Year: 2005
Pages: 143

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net