Sample code for 30+ languages & platforms
Visual Basic 6.0

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 Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 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.

Dim mailman As New ChilkatMailMan

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

'  Open the connection.

success = mailman.OpenSmtpConnection()
If (success = 0) Then
    Debug.Print mailman.LastErrorText
    Exit Sub
End If

'  Reset the current SMTP mail transaction.
success = mailman.SmtpReset()
If (success = 0) Then
    Debug.Print mailman.LastErrorText
    Exit Sub
End If

success = mailman.CloseSmtpConnection()
If (success = 0) Then
    Debug.Print mailman.LastErrorText
    Exit Sub
End If

Debug.Print "Sent SMTP RSET."