Visual FoxPro
Visual FoxPro
Authenticate with the SMTP Server
See more SMTP Examples
Demonstrates the Chilkat MailMan.SmtpAuthenticate method, which authenticates with the SMTP server using the current SMTP property settings, such as SmtpUsername and SmtpPassword. It is typically called after SmtpConnect. This example connects and then authenticates.
Background: SMTP authentication is a separate step from connecting: after the
EHLO handshake, the client proves its identity via the AUTH command using a mechanism the server offers (LOGIN, PLAIN, CRAM-MD5, XOAUTH2, etc.). Splitting connect and authenticate into explicit calls lets you pinpoint exactly which step fails — and hold an authenticated connection open to send many messages efficiently.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loMailman
lnSuccess = 0
* Demonstrates the MailMan.SmtpAuthenticate method, which authenticates with the SMTP server
* using the current SMTP property settings (such as SmtpUsername and SmtpPassword). It is
* typically called after SmtpConnect.
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"
* Connect first, then authenticate.
lnSuccess = loMailman.SmtpConnect()
IF (lnSuccess = 0) THEN
? loMailman.LastErrorText
RELEASE loMailman
CANCEL
ENDIF
lnSuccess = loMailman.SmtpAuthenticate()
IF (lnSuccess = 0) THEN
? loMailman.LastErrorText
RELEASE loMailman
CANCEL
ENDIF
? "Authenticated with the SMTP server."
RELEASE loMailman