Codestone Ltd logo

Search FAQ


Internet Mail Client Control FAQs/Objects/Settings Object

How do I use optionSocketLogFile

ID: S16E22 DATE: N/A

While you are debugging your application you may at times wish to review the conversation between the SMTPClient or POP3Client Object and the SMTP or POP3 server.

In most cases logging the session is unnecessary; the .LastServerResponseString of the POP3Client and .LastServerResponseCode and .LastServerResponseString properties of the SMTPClient Object will usually provide you with enough information to analyse protocol errors.

Logging the session may be useful if you have some knowledge of the SMTP and/or POP3 protocols; additionally Codestone support staff may occasionally request that you log the session.

By creating a Settings Object and setting optionSocketLogFile to the path of a file you can capture the traffic between the client component and the server.

Enabling the logging option imposes a substantial performance overhead and you should only enable the option on your development system; you should never ship your application to your customers with logging enabled.

Example

' Log smtp traffic to a file

' __NB__ Pops up a message box - never release to your
' customers with logging enabled!

' instantiate a Settings Object
set settings=CreateObject("CSMail.Settings")

' open the log file
' (the previous contents of the file will be deleted)
settings.option(9)="c:\csmail_smtp.log"

' connect to server etc here...
' ...

' close the log file
settings.option(9)=""

Related questions


Can't find the answer to your question? We're here to help!