J-ASP POP3

J-ASP POP3 allows you to receive mail using the industry standard POP3 protocol from any program that can run Java. Features include:

  1. POP3 (retrieve) Messages
  2. Multiple File Attachments
  3. US Ascii and ISO-8859-1 character sets
  4. Exposes standard headers via properties and special
    properties via a method.

Requirements:

J-ASP POP3 is based on Sun's Java Mail API, please set Sun's mail.jar and activation.jar to the classpath.

Simple Example

Using J-ASP POP3 is simple:

  1. Creating the object
  2. Setting a few properties
  3. Calling the Retrieve method

The following code demonstrates how to use J-ASP POP3 in VBScript.


	Set Mailer = Server.CreateObject("JASP.Pop3Mail")
	Mailer.RemoteHost = "mail.host.com"
	Mailer.UserName   = "davis"
	Mailer.Password   = "pop3 password" 
	Mailer.OpenPop3 
	Mailer.Retrieve 1 
	Mailer.ClosePop3 
	Response.Write Mailer.MessageID & "<BR>" 
	Response.Write Mailer.Date & "<BR>" 
	Response.Write Mailer.Subject & "<BR>" 
	Response.Write Mailer.FromName & "<BR>" 
	Response.Write Mailer.FromAddress & "<BR>" 
	Response.Write Mailer.BodyText 
	Mailer.ClosePop3
			

J-ASP POP3 Properties

Property Description
AttContentType Contains the ContentType for a message attachment
after you call Mailer.GetAttachmentInfo.
AttFileName Contains the FileName for a message attachment after you call Mailer.GetAttachmentInfo.
AttFileSize Contains the FileSize for a message attachment after you call Mailer.GetAttachmentInfo.
AttachmentCount After you have retrieved a message the AttachmentCount property contains the number of attachements that were found within the message.
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.
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.
FromAddress The message originator¡¯s email address.
FromName The message originator¡¯s name.
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.
MessageID The MessageID property returns the MessageID header for the Retrieved message.
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.
Priority Gets the message priority. Priorities are 1-5 and are reflected in the X-Priority header.
Valid values:
  • 1 ¨C High
  • 3 ¨C Normal
  • 5 ¨C Low
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.
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 JaspPop3.

J-ASP POP3 Methods

Method Description
ClosePop3 Quits the current POP3 session and closes the connection.
Delete Permanently deletes the specified message from the server.
GetAttachmentInfo GetAttachment Info will get the properties for the specified attachment and fill in the AttContentType, AttFileName and AttFileSize properties.
GetHeaderField GetHeaderField is provided so that you can query the current message for any specific header field information that isn't provided through AspPOP3 properties.
OpenPop3 The OpenPop3 method opens the connection to the POP3 RemoteHost using the UserName and Password properties.
Retrieve 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 RetrieveToFile simply pulls the message without processing anything. The entire message including any attachments is saved to the file.
RetrieveToMemory Retrieves the specified message and returns the message in an unprocessed form.
SaveAttachment SaveAttachment will save an attachment to the MailDirectory's path. SaveAttachment will attempt to determine the proper file name before saving.
SaveAttachmentToFile SaveAttachment will save an attachment to the MailDirectory's path. SaveAttachmentToFile uses strFileName as the filename to save the message to.