Sample code for 30+ languages & platforms
Visual FoxPro

Clear the SMTP Session Log

See more SMTP Examples

Demonstrates the Chilkat MailMan.ClearSmtpSessionLog method, which clears the current contents of the SmtpSessionLog property. This example opens an SMTP connection (which populates the log) and then clears it.

Background: Like its POP3 counterpart, the SmtpSessionLog records the raw client/server dialog — the EHLO, AUTH, MAIL FROM, RCPT TO, and DATA exchanges — which is the first thing to inspect when a send fails. Clearing it between sends keeps the captured log focused on the operation you care about rather than the entire history of a reused MailMan object.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loMailman

lnSuccess = 0

*  Demonstrates the MailMan.ClearSmtpSessionLog method, which clears the current contents of
*  the SmtpSessionLog property.

loMailman = CreateObject('Chilkat.MailMan')

*  Configure the SMTP server connection.
loMailman.SmtpHost = "smtp.example.com"
loMailman.SmtpPort = 465
loMailman.SmtpSsl = 1
loMailman.SmtpUsername = "user@example.com"
loMailman.SmtpPassword = "myPassword"

*  Perform an SMTP operation, which populates the session log.

lnSuccess = loMailman.OpenSmtpConnection()
IF (lnSuccess = 0) THEN
    ? loMailman.LastErrorText
    RELEASE loMailman
    CANCEL
ENDIF

*  Clear the SMTP session log (for example, before the next operation).
loMailman.ClearSmtpSessionLog()

lnSuccess = loMailman.CloseSmtpConnection()
IF (lnSuccess = 0) THEN
    ? loMailman.LastErrorText
    RELEASE loMailman
    CANCEL
ENDIF

? "SMTP session log cleared."

RELEASE loMailman