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

 

 

 

 

 

 

Fetch Single Email by UID or Sequence Number

Download 32-bit Chilkat IMAP ActiveX (.msi)

Download All 32-bit Chilkat ActiveX Components (.zip)

Download All 64-bit Chilkat ActiveX Components (.zip)

Assuming the UID is known, download a single email by UID from an IMAP mail server.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set imap = Server.CreateObject("Chilkat.Imap")

'  Anything unlocks the component and begins a fully-functional 30-day trial.
success = imap.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
    Response.Write Server.HtmlEncode(imap.LastErrorText) & "<br>"

End If

'  Connect to an IMAP server.
success = imap.Connect("mail.chilkatsoft.com")
If (success <> 1) Then
    Response.Write Server.HtmlEncode(imap.LastErrorText) & "<br>"

End If

'  Login
success = imap.Login("***","***")
If (success <> 1) Then
    Response.Write Server.HtmlEncode(imap.LastErrorText) & "<br>"

End If

'  Select an IMAP mailbox
success = imap.SelectMailbox("Inbox")
If (success <> 1) Then
    Response.Write Server.HtmlEncode(imap.LastErrorText) & "<br>"

End If

uid = 2014
isUid = 1

Set email = imap.FetchSingle(uid,isUid)
If (Not (email Is Nothing )) Then

    '  Display the From and Subject
    Response.Write Server.HtmlEncode(email.FromAddress) & "<br>"
    Response.Write Server.HtmlEncode(email.Subject) & "<br>"

    '  Display the Body property, which is the default body.
    '  If an email has an HTML body, the Body property contains
    '  the HTML source.  Otherwise it contains the plain-text
    '  body.
    Response.Write Server.HtmlEncode("---- EMAIL BODY ----") & "<br>"
    Response.Write Server.HtmlEncode(email.Body) & "<br>"
    Response.Write Server.HtmlEncode("--------------------") & "<br>"

    '  Display the recipients:

    For j = 0 To email.NumTo - 1
        Response.Write Server.HtmlEncode(email.GetToName(j) _
             & ", " & email.GetToAddr(j)) & "<br>"
    Next
    For j = 0 To email.NumCC - 1
        Response.Write Server.HtmlEncode(email.GetCcName(j) _
             & ", " & email.GetCcAddr(j)) & "<br>"
    Next

    '  Show the total size of the email, including body and attachments:
    Response.Write Server.HtmlEncode(email.Size) & "<br>"

    '  When a full email is downloaded, we would use the
    '  email.NumAttachments property in conjunction with the
    '  email.GetMailAttach* methods.
    '  However, when an email object contains only the header,
    '  we need to access the attachment info differently:
    numAttach = imap.GetMailNumAttach(email)
    Response.Write Server.HtmlEncode(numAttach) & "<br>"

    For j = 0 To numAttach - 1
        Response.Write Server.HtmlEncode(imap.GetMailAttachFilename(email,j)) & "<br>"
        attachSize = imap.GetMailAttachSize(email,j)
        Response.Write Server.HtmlEncode("    size = " _
             & attachSize & " bytes") & "<br>"
    Next

    Response.Write Server.HtmlEncode("--") & "<br>"

End If

'  Disconnect from the IMAP server.
imap.Disconnect 
%>
</body>
</html>

 

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