Sample code for 30+ languages & platforms
Visual FoxPro

Send an SMTP RSET Command

See more SMTP Examples

Demonstrates the Chilkat MailMan.SmtpReset method, which sends an SMTP RSET command to the server. RSET resets the server-side state of the current mail transaction. This example opens a connection, sends RSET, and closes.

Background: During an SMTP session a message is built up across MAIL FROM and RCPT TO commands. If you need to abandon that partially-specified transaction — say an error occurred midway — RSET clears it without dropping the connection, so the same authenticated session can start a fresh message. It's a lightweight way to recover in-session rather than reconnecting.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loMailman

lnSuccess = 0

*  Demonstrates the MailMan.SmtpReset method, which sends an SMTP RSET command to the server.
*  RSET resets the server-side state of the current mail transaction.

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"

*  Open the connection.

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

*  Reset the current SMTP mail transaction.
lnSuccess = loMailman.SmtpReset()
IF (lnSuccess = 0) THEN
    ? loMailman.LastErrorText
    RELEASE loMailman
    CANCEL
ENDIF

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

? "Sent SMTP RSET."

RELEASE loMailman