ASP Examples

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

ASP Examples

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

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
DH Key Exchange
DSA
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

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

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
'  The mailman object is used for sending and receiving email.
set mailman = Server.CreateObject("Chilkat.MailMan2")

'  Any string argument automatically begins the 30-day trial.
success = mailman.UnlockComponent("30-day trial")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( mailman.LastErrorText) & "</pre>"

End If

'  Set the SMTP server.
mailman.SmtpHost = "smtp.chilkatsoft.com"

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

'  Connect and authenticate:
success = mailman.OpenSmtpConnection()
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( mailman.LastErrorText) & "</pre>"

End If

strCharset = "ansi"

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

bEncodeBase64 = False
strResponse = mailman.SmtpSendRawCommand("CPWD",strCharset,bEncodeBase64)
If (strResponse = vbNullString ) Then
    Response.Write "<pre>" & Server.HTMLEncode( mailman.LastErrorText) & "</pre>"

End If

'  Expecting a 334 response...
If (mailman.LastSmtpStatus <> 334) Then
    Response.Write "<pre>" & Server.HTMLEncode( strResponse) & "</pre>"

End If

'  Now send the existing login/password, base64-encoded:
bEncodeBase64 = True

'  Send the existing login:
strResponse = mailman.SmtpSendRawCommand("mySmtpLogin",strCharset,bEncodeBase64)
If (strResponse = vbNullString ) Then
    Response.Write "<pre>" & Server.HTMLEncode( mailman.LastErrorText) & "</pre>"

End If

'  Expecting a 334 response...
If (mailman.LastSmtpStatus <> 334) Then
    Response.Write "<pre>" & Server.HTMLEncode( strResponse) & "</pre>"

End If

'  Send the existing password:
strResponse = mailman.SmtpSendRawCommand("mySmtpPassword",strCharset,bEncodeBase64)
If (strResponse = vbNullString ) Then
    Response.Write "<pre>" & Server.HTMLEncode( mailman.LastErrorText) & "</pre>"

End If

'  Expecting a 334 response...
If (mailman.LastSmtpStatus <> 334) Then
    Response.Write "<pre>" & Server.HTMLEncode( strResponse) & "</pre>"

End If

'  Send the new password:
strResponse = mailman.SmtpSendRawCommand("myNewSmtpPassword",strCharset,bEncodeBase64)
If (strResponse = vbNullString ) Then
    Response.Write "<pre>" & Server.HTMLEncode( mailman.LastErrorText) & "</pre>"

End If

'  Expecting a 250 response...
If (mailman.LastSmtpStatus <> 250) Then
    Response.Write "<pre>" & Server.HTMLEncode( strResponse) & "</pre>"

End If

Response.Write "<pre>" & Server.HTMLEncode("SMTP password changed!") & "</pre>"

success = mailman.CloseSmtpConnection()
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode("Connection to SMTP server not closed cleanly.") & "</pre>"
End If


%>
</body>
</html>

 

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