Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Classic ASP Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Cert Store
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(Classic ASP) Debug / Verify SMTP Session

An SMTP client, such as the Chilkat Email component or Outlook, is responsible for passing an email to an SMTP server. Typically, the client connects to a single (i.e. your) SMTP server that acts as a relay to deliver email destined for a remote mail server. The "handoff" to your SMTP server is the 1st step in the mail delivery process. An SMTP client can only ensure that this handoff happens without error. After the handoff is complete, it is the SMTP server's job to relay the email to a remote SMTP server (or perhaps some intermediate server) to complete delivery. If the recipient indicates that he/she never received the email, the 1st step in debugging is to verify that the "handoff" happened without error. This is what this example is intended to demonstrate.

If there are no errors in the "handoff", then the non-delivery problem occurred downstream (i.e. at some point after your SMTP server accepted the email from you, the SMTP client). The most common cause for "non-delivery" is that the recipient's anti-SPAM filters rejected the email, or automatically placed it in his/her Junk email folder. Ask the recipient to check for that possibility.

If the recipient claims that anti-SPAM is not the cause, then you'll need to check your SMTP server's logs, and the recipient should check his/her mail server logs. Try to verify if your SMTP server successfully relayed the email. For the remote (receiving) mail server, try to see if the logs indicate that the mail was received. If so, was it rejected?

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
'  The interesting part of this example is near the bottom of this
'  page where the SmtpSessionLog is captured and displayed.
' 

'  The mailman object is used for sending and receiving email.
set mailman = Server.CreateObject("Chilkat_9_5_0.MailMan")

'  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 = "myLogin"
mailman.SmtpPassword = "myPassword"

'  Create a new email object
set email = Server.CreateObject("Chilkat_9_5_0.Email")

email.Subject = "This is a test"
email.Body = "This is a test"
email.From = "Chilkat Support <support@chilkatsoft.com>"
success = email.AddTo("Chilkat Gmail","chilkat.support@gmail.com")
success = email.AddTo("Chilkat Yahoo","chilkat_software@yahoo.com")

'  Call SendEmail to connect to the SMTP server and send.
'  The connection (i.e. session) to the SMTP server remains
'  open so that subsequent SendEmail calls may use the
'  same connection.
success = mailman.SendEmail(email)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( mailman.LastErrorText) & "</pre>"

End If

'  Some SMTP servers do not actually send the email until
'  the connection is closed.  In these cases, it is necessary to
'  call CloseSmtpConnection for the mail to be  sent.
'  Most SMTP servers send the email immediately, and it is
'  not required to close the connection.  We'll close it here
'  for the example:
success = mailman.CloseSmtpConnection()
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( "Connection to SMTP server not closed cleanly.") & "</pre>"
End If

Response.Write "<pre>" & Server.HTMLEncode( mailman.SmtpSessionLog) & "</pre>"

'  A sample SMTP session log is included below.
'  There are two key items to verify:
'  1) Each recipient in the email (To, CC, BCC) should be present in the log
'      in a "RCPT TO" command.  You may visually verify that the response
'      from the SMTP server was "250 OK" for each recipient.
'      (Chilkat also provides a way to get the failed RCPT TO responses programmatically...)
'   2) The "DATA" command is followed by the client sending the full MIME source of the email,
'        followed by a single line containing a ".".
'        The final response from the SMTP server should be a "250 OK".
'  If all of the RCPT TO commands were successful, and the final SMTP response was success,
'  then the client-to-SMTP-server handoff was successful.  If a delivery problem is reported by
'  a recipient, the problem occurred downstream of this "handoff".

'  220 mail.chilkatsoft.com ESMTP  648143d3667b3045487bb901cdbbf649
'  250-mail.chilkatsoft.com
'  250-PIPELINING
'  250-SIZE 100000000
'  250-DATAZ
'  250-AUTH LOGIN PLAIN
'  250 8BITMIME
'  AUTH LOGIN
'  334 xxxxxxxxxxxx
'  334 xxxxxxxxxxxx
'  235 nice to meet you
'  MAIL FROM:<support@chilkatsoft.com>
'  250 ok
'  RCPT TO:<chilkat.support@gmail.com>
'  250 ok
'  RCPT TO:<chilkat_software@yahoo.com>
'  250 ok
'  DATA
'  354 go ahead
'  MIME-Version: 1.0
'  Date: Wed, 19 Mar 2008 08:40:52 -0500
'  X-Mailer: Chilkat Software Inc (http://www.chilkatsoft.com)
'  X-Priority: 3 (Normal)
'  Subject: This is a test
'  Content-Type: text/plain
'  Content-Transfer-Encoding: quoted-printable
'  From: "Chilkat Support" <support@chilkatsoft.com>
'  To: "Chilkat Gmail" <chilkat.support@gmail.com>,
'           "Chilkat Yahoo" <chilkat_software@yahoo.com>
'  Message-ID: <CHILKAT-MID-02039824-9296-78bb-fff7-88fe94e86148@CK2007>
' 
'  This is a test
'  .
'  250 ok 1205934062 qp 28546 by mail.chilkatsoft.com

%>
</body>
</html>

 

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