cfpop

Description

Retrieves and deletes e-mail messages from a POP mail server.

Category

Internet Protocol tags

Syntax


<cfpop server = "servername"

  port = "port_number"

  username = "username"

  password = "password"

  action = "action"

  name = "queryname"

  messageNumber = "number"

  attachmentPath = "path"

  timeout = "seconds"

  maxRows = "number"

  startRow = "number"

  generateUniqueFilenames = "boolean"> 

See also

cfftp, cfhttp, cfldap, cfmail, cfmailparam

Attributes

Attribute
Description
server
Required. Host name (biff.upperlip.com) or IP address (192.1.2.225) of the POP server.
port
Optional. Defaults to the standard POP port, 110.
username
Optional. If no user name is specified, the POP connection is anonymous.
password
Optional. Password that corresponds to user name.
action
Optional. Specifies the mail action. Options:
  • getHeaderOnly    (Default) Returns message header information only.
  • getAll    Returns message header information, message text, and attachments if attachmentPath is specified.
  • delete    Deletes messages on the POP server.
name
Optional. Name for the index query. Required for action = "getHeaderOnly" and action = "getAll".
messageNumber
Optional. Specifies the message number(s) for the given action. messageNumber is required for action = "delete". If it is provided for action = "getHeaderOnly" or action = "getAll", only referenced messages are retrieved. If it is omitted for action = "getHeaderOnly" or action = "getAll", all messages available on the server are returned.
messageNumber can contain individual message numbers or a comma-separated list of message numbers. Invalid message numbers are ignored.
attachmentPath
Optional. Allows attachments to be written to the specified directory when action = "getAll". If an invalid attachmentPath is specified, no attachment files are written to the server.
timeout
Optional. Specifies the maximum time, in seconds, to wait for mail processing. Defaults is 60 seconds.
maxRows
Optional. Sets the number of messages returned, starting with the number in the startRow attribute. This attribute is ignored if messageNumber is specified.
startRow
Optional. Specifies the first row number to be retrieved. Default is 1. This attribute is ignored if messageNumber is specified.
generateUniqueFilenames
Optional. Boolean indicating whether to generate unique filenames for the files attached to an e-mail message to avoid naming conflicts when the files are saved. Default is NO.

Usage


Note

Two retrieve options are offered to maximize performance. Message header information is typically short and therefore quick to transfer. Message text and attachments can be very long and therefore take longer to process. See the Message Header and Body Columns table, which follows the cfpop attribute descriptions, for information on retrieving header and body information from the query when you specify getHeaderOnly or getAll.


cfpop query variables

The following table describes the query variables that are returned by cfpop.
Variable Names
Description

queryname.recordCount 

The number of records returned by the query.

queryname.currentRow 

The current row of the query being processed by cfoutput.

queryname.columnList 

The list of the column names in the query.

Message header and body columns

The following table lists the message header and body columns returned by cfpop when you specify the action attribute as either getHeaderOnly or getAll.
Column Name
getHeaderOnly returns
getAll returns

queryname.date 

yes
yes

queryname.from 

yes
yes

queryname.messagenumber 

yes
yes

queryname.replyto 

yes
yes

queryname.subject 

yes
yes

queryname.cc 

yes
yes

queryname.to 

yes
yes

queryname.body 

not available
yes

queryname.header 

not available
yes

queryname.attachments 

not available
yes

queryname.attachmentfiles 

not available
yes

To create a ColdFusion date/time object from the date-time string that is extracted from a mail message in the queryname.date column, use the following table.
Locale
What to do

English (US) locale 

Use the ParseDateTime function and specify the POP attribute, which converts the date-time value to Greenwich Mean Time.

Other locales 

Extract the date portion of the string and pass it to the LSParseDateTime function, then add or subtract the conversion time, depending on the locale.

See also the description of the SetLocale function.

For complete usage information on cfpop, see Developing ColdFusion Applications.

Example

<!--- This view-only example shows the use of cfpop --->

<html>

<head>

<title>cfpop Example</title>

</head>



<body>

<H3>cfpop Example</H3>

<P>cfpop allows you to retrieve and manipulate mailin a POP3 mailbox.

This view-only example shows how to create one feature of a mail client,

allowing you to display the mail headers in a POP3 mailbox.



<P>Simply uncomment this code and run with a mail-enabled CF Server to

see this feature in action.

<!--- 

<cfif IsDefined("form.server ")>

<!--- make sure server, username are not empty --->

<cfif form.server is not "" and form.username is not "">

   <cfpop server = "#server# " username = #UserName# password = #pwd#

   action = "GETHEADERONLY " name = "GetHeaders ">

   

   <H3>Message Headers in Your Inbox</H3>

   <P>Number of Records: 

   <cfoutput>#GetHeaders.recordCount#</cfoutput></P>

   <UL>

   <cfoutput query = "GetHeaders">

     <LI>Row: #currentRow#: From: #From# -- Subject: #Subject#

   </cfoutput>

  </UL>

</cfif>

</cfif>



<form action = "cfpop.cfm " method = "POST ">

<P>Enter your mail server:

<P><input type = "Text " name = "server ">

<P>Enter your username:

<P><input type = "Text " name = "username ">

<P>Enter your password:

<P><input type = "password " name = "pwd ">

<input type = "Submit " name = "get message headers ">

</form> 

--->



</body>

</html>    



Banner.Novgorod.Ru