About AspPOP3
AspPOP3 allows you to receive mail using the industry standard
POP3 protocol from any program that can use ActiveX/OLE components. Features
include:
-
POP3 (retrieve) Messages
-
Multiple File Attachments
-
File attachments support MIME and UUEncoding
-
US Ascii and ISO-8859-1 character sets
-
Exposes standard headers via properties and special properties
via a method.
Changes in AspPOP3 2.0
AspPOP3 2.0 builds on the functionality of AspPOP3 1.0 by
replacing the POP3 "plumbing" with an improved implementation, provides
automatic decoding of file attachments, provides a complete type library and
provides dual interface support.
AspPOP3 Installation
To use this ASP component move the DLL into a subdirectory
(like \winnt\system32 for NT or \windows\system for Win95). Please use the
version of regsvr32 that is included with this component or the version that
comes with Microsoft ASP (they are the same version).
To register the component on the system change to the directory
where you installed the DLL and type:
regsvr32 pop3svg.dll
You may need to modify this example based on the directory you
have installed the component to.
Simple Retrieve Mail Example
Using the component is as simple as
-
Creating the object
-
Setting a few properties
-
Calling the Retrieve method
The following code demonstrates how to use AspPOP3 from VBScript.
Set Mailer = Server.CreateObject("POP3svg.Mailer")
Mailer.RemoteHost = "mailhost.localisp.net"
Mailer.UserName = "myname"
Mailer.Password = "mypassword"
Mailer.OpenPop3
rem We could do multiple retrieves here but this demo only shows the
rem selected message.
Mailer.MailDirectory = "d:\usermail\myname"
Mailer.RetrieveToFile 1, "1.txt"
Mailer.ClosePop3
The file d:\usermail\myname\1.txt now holds the complete message
text for this message. You could optionally do the following:
Set Mailer = Server.CreateObject("POP3svg.Mailer")
Mailer.RemoteHost = "mailhost.localisp.net"
Mailer.UserName = "myname"
Mailer.Password = "mypassword"
Mailer.OpenPop3
rem We could do multiple retrieves here but this demo only shows the
rem selected message.
Mailer.Retrieve 1
Mailer.ClosePop3
You can now use Mailer's properties to examine each part of the message. For example:
Mailer.MessageID
Mailer.Date
Mailer.Subject
Mailer.FromName
Mailer.FromAddress
Mailer.BodyText
And so on, contain the respective message properties.
Notes About Creating the Pop3 Object
You can create the mailer object at three different points in
time:
-
Immediately before retrieving email
-
At the application scope
-
At the session scope
You will have to decide when and where it is appropriate to
create the object based on your particular application. If you aren't sure
which way to create the object reference, or for typical usage, you should
create the object immediately before retrieving your email. Your code would
look like this:
Set Mailer = Server.CreateObject("POP3svg.Mailer")
... [Set properties]
if Mailer.Retrive intMsgNo then ...
Creating these local references, as demonstrated above, allow you
to use the object on multiple application threads at the same time.
If you wish to create and reuse the object at the application or
session scope you must insure that only one user is using the application or
session object reference using some queing mechanism. To create an object
reference at the application scope your code would look something like this:
if Not IsObject (Application("Mailer")) then
Set Mailer = Server.CreateObject("POP3svg.Mailer")
Application.Lock
Set Application("Mailer") = Mailer
Application.Unlock
else
Response.write "Cached application object reference being used<p>"
Set Mailer = Application("Mailer")
end if
Finally, to create an object reference at the session level, your
code might look something like this:
if Not IsObject (session("Mailer")) then
Set Mailer = Server.CreateObject("POP3svg.Mailer")
Set session("Mailer") = Mailer
else
Response.write "Cached session object reference being used<p>"
Set Mailer = session("Mailer")
end if
About purchasing AspPOP3
-
The registration license fee covers only one CPU per license.Dual
CPU systems require one license for each CPU. You can purchase by following the
link from http://www.serverobjects.com/products.htm.
About Upgrades
-
Users can upgrade for free for minor version changes. For
example, upgrades from version 1.00 to 1.99 are free. The upgrade from 1.99 to
2.0 may carry an additional license fee.
-
The latest version of the components are always available at
http://www.serverobjects.com/products.htm. If a fee is associated with
obtaining the upgrade it will be noted on that page.
Upgrade Instructions
To upgrade the component from a previous version please follow
these steps:
-
Stop all IIS related services such as Gopher, FTP and W3SVC.
-
Change to the directory where the component is located and type
"regsvr32 /u pop3svg.dll"
-
Move the new copy of pop3svg.dll to the current directory and
type "regsvr32 pop3svg.dll"
-
Restart the necessary services.
Questions about AspPOP3
| WebTV attachments appear as part of the message
body. |
Yes, that's correct. For whatever reason, the WebTV
developers decided to create attachments "inline" to the standard message body.
AspPOP3 does not currently support inline'd attachments. We are not aware of
any other software packages that automatically create inline'd attachments. |
| How do I change the status of the message (read /
unread etc.) |
You don't. Most servers do not provide an interface
to change the message status manually. This is an automated process so that
once the body text is retrieved the message status is automatically updated. |
| Message status is not being updated or is not
returned. |
Some servers (some or all versions of Exchange)
don't provide POP3 message status. If AspPOP3 is not returning a status value,
then the value is not being returned by your server. |
| When I use your examples and click on a message I
get nothing but a string of ????'s. What's wrong? |
That indicates that the user (user the anon IIS
user) lacks security to write or read to the location specified by the
MailDirectory property. |
I cannot get the component to return the MessageID
field [or some other value]. What's wrong. Here's my code:
If Mailer.GetPopHeader (1) Then
Response.Write Mailer.GetHeaderField("Message-Id")
End If
|
Either the value does not exists or more likely you
are unaware of the fact that MessageID values are surrounded by the characters
< and > which makes it look like an HTML tag to many browsers, therefore
the value is getting sent to the browser (do a View Source) but it is not
getting rendered onto the browser screen because it appears to be an [invalid]
HTML tag to the browser rendering engine. The solution is to string replace the
< > characters with < > which will then display literal
<> values around the MessageID |
Technical Support
If you require technical support please see our tech support page
at http://www.serverobjects.com/support.htm
AspPOP3 Properties
| AttContentType |
Contains the ContentType for a message
attachment after you call Mailer.GetAttachmentInfo.
Example:
if Mailer.GetAttachmentInfo (intCount) then
Response.Write "ContentType=" & Mailer.AttContentType
|
| AttFileName |
Contains the FileName for a message
attachment after you call Mailer.GetAttachmentInfo.
Example:
if Mailer.GetAttachmentInfo (intCount) then
Response.Write "FileName=" & Mailer.AttFileName
|
| AttFileSize |
Contains the FileSize for a message
attachment after you call Mailer.GetAttachmentInfo.
Example:
if Mailer.GetAttachmentInfo (intCount) then
Response.Write "File Size=" & Mailer.AttFileSize
|
| AttachmentCount |
After you have retrieved a message the AttachmentCount property
contains the number of attachements that were found within the message.
Example:
Mailer.Retrieve intMsgNumber
Response.Write "This message has " & _
Mailer.AttachmentCount & " attachments"
|
| BodyText |
After you have retrieved a message the BodyText property
contains the message text. This does not include header information which is
accessed via other properties and one method.
Example:
Mailer.Retrieve intMsgNumber
Response.Write "This message is " & _
Mailer.BodyText
|
| CC |
The CC property contains any CarbonCopy addresses the message
was sent to. |
| Error |
The Error property returns any error message if a failure is
detected by the component. |
| Encoding |
The encoding type used for the message.
Valid values:
Example:
If Mailer.Encoding = 1 then Response.Write "UUEncoded"
|
| Expires |
If the component is an eval version the
expires property will return the date that the component quits functioning.
Example:
Response.Write "Component Expires: " & Mailer.Expires
|
| FromAddress |
The message originator’s email address.
Example:
Response.Write "From " & Mailer.FromAddress
|
| FromName |
The message originator’s name.
Example:
Response.Write "From " & Mailer.FromName
|
| MailDirectory |
The MailDirectory property specifies
where mail will be written to when the RetrieveToFile method is used. |
| MessageCount |
The MessageCount property indicates how
many messages are located on the server. This property is updated when the
GetPopHeaders method is called or when MessageCount is 0.
Example:
if Mailer.MessageCount = 0 then
Response.Write "There are no messages on the server."
end if
|
| MessageID |
The MessageID property returns the MessageID header for the
Retrieved message. |
| MessageInfo |
The MessageInfo property returns the header data that is
received from a call to GetPopHeaders. After a call to GetPopHeaders, and if
there are messages on the server, this property is a variant array of variant
arrays that contains information about the messages on the server.
Values returned are: intMessageID, strSubject, strDate, strFrom,
strSender ,strTo, strReplyTo, intSize, strStatus.
|
| Password |
Password is the password of the account on the POP3 server that
you will be retrieving messages for. This is used along with UserName to log
into the POP server. |
| Pop3Log |
You can debug a POP3 session by assigning a path and filename to
the POP3Log property. The complete POP3 session will be written to this file.
Be sure the logged in user under IIS has permission to write to this file. Do
NOT use this in a multi-user environment. This is only for debugging. |
| Priority |
Gets the message priority. Priorities
are 1-5 and are reflected in the X-Priority header.
Valid values:
-
1 – High
-
3 – Normal
-
5 – Low
Example:
if Mailer.Priority = 1 then
Response.Write "This message is high priority"
end if
|
| Recipients |
The Recipients property contains any
To: addresses the message was sent to. |
| RemoteHost |
RemoteHost property should be set to the host name or IP address
of the POP3 server you will be pulling messages from. |
| ReturnReceipt |
The ReturnReceipt flag.
Example:
If Mailer.ReturnReceipt then
rem User expected return receipt on this message
end if
|
| Subject |
The Subject property returns the
Subject of the message that you have retrieved. |
| TimeOut |
Sets the maximum time to wait for a
response from the POP3 server. |
| UserName |
UserName is the user name of the
account on the POP3 server that you will be retrieving messages for. This is
used along with Password to log into the POP server. |
| Version |
Returns the version of the Pop3
component. |
AspPOP3 Component Methods
| Method |
Parameters |
Return Value |
Description |
| ClosePop3 |
None |
N/A |
Quits the current POP3 session and closes the
connection. |
| Delete |
Integer value indicating which message on the
server to delete. |
True/False |
Permanently deletes the specified message from the
server. |
| EraseFile |
String value indicating full path to file you want
to erase. |
True/False |
Permanently deletes a file from the local drive.
This is used to clean up messages that are written to disk using the
RetrieveToFile method. |
| GetAttachmentInfo |
Integer value indicating which message attachment
you want to get the properties for. |
N/A |
GetAttachment Info will get the properties for the
specified attachment and fill in the AttContentType, AttFileName and
AttFileSize properties. |
| GetHeaderField |
String value indicating which header field you want
to return |
String value with header field info. |
GetHeaderField is provided so that you can query
the current message for any specific header field information that isn't
provided through AspPOP3 properties. |
| GetPopHeader |
Integer value indicating the message number to
retrieve the header for. |
True or False |
GetPopHeader allows you to retrieve the header
information for one message instead of all messages. See GetPopHeaders to
retrieve all message headers. |
| GetPopHeaders |
None |
True or False |
GetPopHeaders provides a simple interface to
retrieving information about each message on the server. This makes it easy to
present a list of message info. The examples provided with AspPOP3, WebMail and
WebMail2 provide good examples of how to use this method. |
| OpenPop3 |
None |
True or False |
The OpenPop3 method opens the
connection to the POP3 RemoteHost using the UserName and Password properties. |
| Retrieve |
Integer value indicating which message
to retrieve from the POP3 server. |
True or False |
The Retrieve method will retrieve the
entire message from the POP3 server including any attachments. Once you have
used Retrieve to get a valid message the AspPOP3 properties are filled in with
the appropriate values and any attachments are available using the attachment
methods/properties. |
| RetrieveToFile |
Integer value indicating which message and a string
value indicating the filename to save to. |
True or False |
RetrieveToFile simply pulls the message without
processing anything. The entire message including any attachments is saved to
the file. |
| RetrieveToMemory |
Integer value indicating which message to retrive |
strMsg - the unprocessed message in string format |
Retrieves the specified message and returns the
message in an unprocessed form. |
| SaveAttachment |
intAttachment
Integer value indicating which attachment to save.
|
True or False |
SaveAttachment will save an attachment to the
MailDirectory's path. SaveAttachment will attempt to determine the proper file
name before saving. |
| SaveAttachmentToFile |
intAttachment, strFileName
Integer value indicating which attachment to save and a pathless
filename to save the attachment into.
|
True or False |
SaveAttachment will save an attachment to the
MailDirectory's path. SaveAttachmentToFile uses strFileName as the filename to
save the message to. |
© Copyright 1996, 1997, 1998, 1999, 2000 by
ServerObjects Inc.
|