O'Reilly logo

Programming ColdFusion MX, 2nd Edition by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieving Messages

You have seen that ColdFusion can send email via the cfmail tag. In addition to sending email, ColdFusion can also retrieve email messages using the Post Office Protocol (POP3) via the cfpop tag. Using this tag, ColdFusion can retrieve message headers, message contents including multi-part messages (this is new in ColdFusion MX 6.1), and file attachments. In essence, this allows you to use ColdFusion to create a web-based email system, like Yahoo! Mail or Hotmail. The cfpop tag can also create applications such as auto-responders and mailing-list managers.

Retrieving Message Headers

The cfpop tag can retrieve just the header portion of email messages stored on a POP server. This is useful when you want to retrieve summary information such as the message title for more than one message. Retrieving just the message headers allows you to avoid the overhead associated with retrieving the entire contents of each message you retrieve. In the context of a web-based email client, this technique is used to build a list of messages in a user’s mailbox. You can retrieve the headers for a group of messages by setting the action attribute of the cfpop tag to GetHeaderOnly as shown in Example 13-8.

Example 13-8. Retrieving message headers

<cfpop action="getheaderonly" name="GetMessageHeaders" server="wcpamh01.amkor.com" port="110" timeout="600" username="rbils" password="leb##sggy" startrow="1" maxrows="100"> <html> <head> <title>Example 13-8: Retrieving Message Headers</title> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required