Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

  

  

  Chilkat ActiveX Components

  Chilkat .NET Components

  Chilkat C++ Libraries

  

  

  

  

 

FAQ

DOWNLOAD ReferenceASP ExamplesVisual Basic Examples


Chilkat Mail Example
Access the data in an Email attachment

This example shows how to access the data in an Email attachment.

<%@ LANGUAGE="VBSCRIPT" %>

<HTML>
<HEAD>
<TITLE>Chilkat Mail Example: Access the data in an e-mail attachment</TITLE>
</HEAD>
<BODY>

Reading email....<br><br>

<%
	' Create a mailman
	set mailman = Server.CreateObject("ChilkatMail.ChilkatMailMan")

	' Get the UnlockCode free from http://www.chilkatsoft.com
	mailman.UnlockComponent "unlock-code"

	' Tell the mailman where to get mail (POP3 server), and the login/password
	mailman.MailHost = "mail.somedomain.com"
	mailman.PopUsername = "my_username"
	mailman.PopPassword = "my_password"

	' Copy the mail without removing it from the server.
	' When reading email, the mailman always returns a MailBundle
	Set mailBundle = mailman.CopyMail

	If Not (mailBundle Is Nothing) Then

		' Loop over the email messages in the bundle
		For i = 0 To mailBundle.messageCount - 1

			Set email = mailBundle.GetEmail(i)

			Response.write "<hr><br><b>Message Number:</b>" & i & "<br>"
			Response.write "<b>From:</b> " & Server.HTMLEncode(email.From) & "<br>"
			Response.write "<b>Subject:</b> " & Server.HTMLEncode(email.Subject) & "<br>"
			Response.write "<b>Number of Attachments:</b>" & email.NumAttachments & "<br>"

			if email.NumAttachments > 0 then
				Response.write "<blockquote>"

				For j = 0 to email.NumAttachments-1
					' Display the attachment filename.
					filename = email.GetAttachmentFilename(j)
					Response.write "<b>Filename: </b> " _
									   & Server.HTMLEncode(filename) & "<br>"

					if InStr(LCase(filename),".txt") then
						Response.write "<blockquote><pre>"
						Response.write Server.HTMLEncode(email.GetAttachmentString(j))
						Response.write "</pre></blockquote><br>"
					end if
				Next

				Response.write "</blockquote><br>"
			end if

			Set email = Nothing
		Next

	End If

	Set mailBundle = Nothing

	' Standard ASP cleanup of objects
	Set mailman = Nothing

%>

<BR>DONE.<BR>

</BODY>
</HTML>


 

 


Privacy Statement. Copyright 2000-2008 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, and Windows 95/98/NT4.