ASP Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

ASP Examples

ASP String
ASP Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
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...
Email Object
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA

Unreleased...
Bzip2
LZW
Icon

 

 

 

 

 

 

Process New Email by Scanning for Senders

Scan email and save application-selected emails to EML files with unique filenames.

Download Chilkat IMAP ActiveX

<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("admin@chilkatsoft.com","*myPassword5*")
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

'  We can choose to fetch UIDs or sequence numbers.
fetchUids = 1

'  Fetch messages from the mailbox using a search criteria.
'  This example finds NEW emails: these are emails that have the RECENT flag set, but not the SEEN flag:
Set messageSet = imap.Search("NEW",fetchUids)
If (messageSet Is Nothing ) Then
    Response.Write Server.HtmlEncode(imap.LastErrorText) & "<br>"

End If

'  This example will download headers, and then download
'  the full email for those emails sent from a contact
'  in our database.

'  When downloading headers, each email object contains
'  (obviously) the headers, but the body will be missing.
'  Also, attachments will not be included.  However, it is
'  possible to get information about the attachments
'  as well as the complete size of the email.

Set bundle = imap.FetchHeaders(messageSet)
If (bundle Is Nothing ) Then

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

End If

'  Loop over the email objects...

For i = 0 To bundle.MessageCount - 1

    Set email = bundle.GetEmail(i)

    '  The sender's email address and name are available
    '  in the From, FromAddress, and FromName properties.
    '  If the sender is "Chilkat Support <support@chilkatsoft.com",
    '  then the From property will hold the entire string.
    '  the FromName property contains"Chilkat Support",
    '  and the FromAddress property contains "support@chilkatsoft.com"
    Response.Write Server.HtmlEncode(email.From) & "<br>"
    Response.Write Server.HtmlEncode(email.FromAddress) & "<br>"
    Response.Write Server.HtmlEncode(email.FromName) & "<br>"

    '  Assume at this point your code checks to see if the sender
    '  is one in your contacts database.  If so, this is
    '  the code you would write to download the entire
    '  email and save it to a file.

    '  The ckx-imap-uid header field is added when
    '  headers are downloaded.  This makes it possible
    '  to get the UID from the email object.
    uidStr = email.GetHeaderField("ckx-imap-uid")
    uid = CLng(uidStr)

    Set fullEmail = imap.FetchSingle(uid,1)
    If (Not (fullEmail Is Nothing )) Then
        '  You may use the GenerateFilename method to
        '  generate a unique filename...

        filename = fullEmail.GenerateFilename()

        '  SaveEml saves the entire email, including attachments.
        fullEmail.SaveEml filename

    End If

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

Next

'  Disconnect from the IMAP server.
imap.Disconnect 


%>
</body>
</html>

 

Need a specific example? Send a request to support@chilkatsoft.com

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