User Guide
212 Developing Web Applications with ColdFusion
Use CFPOP in applications when you want to receive email. Here are two instances
where implementing POP mail makes sense:
• If your site has generic mailboxes that are read by more than one person
(sales@yourcompany.com), it may be more efficient to construct a ColdFusion
mail front-end to supplement individual user mail clients.
• In many applications, the processing of mail can be automated when the mail
is formatted to serve a particular purpose. For example, when subscribing to a
list server.
See the CFML Language Reference for more information on CFPOP syntax and
variables.
Using CFPOP
To implement the CFPOP tag in your ColdFusion application:
1. Choose which mail boxes you want to access within your ColdFusion application.
2. Determine what mail message components you need to process: message header,
message body, attachments, etc.
3. Decide if you need to store the retrieved messages in a database.
4. Decide if you need to delete messages from the POP server once you’ve retrieved
them.
5. Incorporate the CFPOP tag in your application and create a user interface for
accessing a given mailbox.
6. Build an application page to handle the output. Retrieved messages can include
ASCII characters that do not display properly in the browser.
You use the CFOUTPUT tag with the HTMLCodeFormat and HTMLEditFormat
functions to control output to the browser. Note the use of these functions in the
examples.
CFPOP query variables
Two variables are returned for each CFPOP query that provide record number
information:
• RecordCount: The total number of records returned by the query.
• CurrentRow: The current row of the query being processed by CFOUTPUT in a
query-driven loop.
You can reference these properties in a CFOUTPUT tag by prefixing the query variable
with the query name in the NAME attribute of CFPOP:
<CFOUTPUT>
This operation returned #Sample.RecordCount# messages.
</CFOUTPUT>