FoxPro Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

Visual FoxPro Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
Email Object
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
RSA
S/MIME
Socket
Spider
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Amazon S3
DKIM / DomainKey
NTLM
RSS
Atom
Byte Array
Service
PPMD
Deflate
DH Key Exchange
DSA
FileAccess
Bzip2
LZW

 

Non-Chilkat Links
Text and String Handling

Using SmtpSendRawCommand to Change Password

Demonstrates how to use the SmtpSendRawCommand method to change the SMTP user account's password for an SMTP server that supports the non-standard CPWD command.

Note: The SmtpSendRawCommand method is not yet released. To get a pre-release, send email to support@chilkatsoft.com.

Download Chilkat Email ActiveX

LOCAL loMailman
LOCAL lnSuccess
LOCAL lcStrCharset
LOCAL loBEncodeBase64
LOCAL lcStrResponse

*  The mailman object is used for sending and receiving email.
loMailman = CreateObject('Chilkat.MailMan2')

*  Any string argument automatically begins the 30-day trial.

lnSuccess = loMailman.UnlockComponent("30-day trial")
IF (lnSuccess <> 1) THEN
    ? loMailman.LastErrorText
    QUIT
ENDIF

*  Set the SMTP server.
loMailman.SmtpHost = "smtp.chilkatsoft.com"

*  Set the SMTP login/password (if required)
loMailman.SmtpUsername = "myUsername"
loMailman.SmtpPassword = "myPassword"

*  Connect and authenticate:
lnSuccess = loMailman.OpenSmtpConnection()
IF (lnSuccess <> 1) THEN
    ? loMailman.LastErrorText
    QUIT
ENDIF

lcStrCharset = "ansi"

*  Send the CPWD command and get the response.
*  Do not include a trailing CRLF (carriage-return line-feed) in the command string.

loBEncodeBase64 = .F.
lcStrResponse = loMailman.SmtpSendRawCommand("CPWD",lcStrCharset,llBEncodeBase64)
IF (lcStrResponse = NULL ) THEN
    ? loMailman.LastErrorText
    QUIT
ENDIF

*  Expecting a 334 response...
IF (loMailman.LastSmtpStatus <> 334) THEN
    ? lcStrResponse
    QUIT
ENDIF

*  Now send the existing login/password, base64-encoded:
loBEncodeBase64 = .T.

*  Send the existing login:
lcStrResponse = loMailman.SmtpSendRawCommand("mySmtpLogin",lcStrCharset,llBEncodeBase64)
IF (lcStrResponse = NULL ) THEN
    ? loMailman.LastErrorText
    QUIT
ENDIF

*  Expecting a 334 response...
IF (loMailman.LastSmtpStatus <> 334) THEN
    ? lcStrResponse
    QUIT
ENDIF

*  Send the existing password:
lcStrResponse = loMailman.SmtpSendRawCommand("mySmtpPassword",lcStrCharset,llBEncodeBase64)
IF (lcStrResponse = NULL ) THEN
    ? loMailman.LastErrorText
    QUIT
ENDIF

*  Expecting a 334 response...
IF (loMailman.LastSmtpStatus <> 334) THEN
    ? lcStrResponse
    QUIT
ENDIF

*  Send the new password:
lcStrResponse = loMailman.SmtpSendRawCommand("myNewSmtpPassword",lcStrCharset,llBEncodeBase64)
IF (lcStrResponse = NULL ) THEN
    ? loMailman.LastErrorText
    QUIT
ENDIF

*  Expecting a 250 response...
IF (loMailman.LastSmtpStatus <> 250) THEN
    ? lcStrResponse
    QUIT
ENDIF

=MESSAGEBOX("SMTP password changed!")

lnSuccess = loMailman.CloseSmtpConnection()
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX("Connection to SMTP server not closed cleanly.")
ENDIF


© 2000-2010 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Email Component · ASP Mail Component · XML Parser