Developing Web Applications with ColdFusion
|
|
Chapter 13 : Sending and Receiving Email
|
Receiving Email Messages
CFPOP, the Post Office Protocol tag, expands the ColdFusion developer's ability to add Internet mail client features and email consolidation to applications. While a conventional mail client provides an adequate interface for personal mail, there are many cases where an alternative interface to some mailboxes is desirable. CFPOP is a tool to develop targeted mail clients to suit the specific needs of a wide range of applications.
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:
|
- Choose which mail boxes you want to access within your ColdFusion application.
- Determine what mail message components you need to process: message header, message body, attachments, etc.
- Decide if you need to store the retrieved messages in a database.
- Decide if you need to delete messages from the POP server once you've retrieved them.
- Incorporate the CFPOP tag in your application and create a user interface for accessing a given mailbox.
- 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>
Copyright © 1999, Allaire Corporation. All rights reserved.
|
|