O'Reilly logo

Programming ColdFusion 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

Building a Web-Based Email Client

Now that you have a feel for how the CFMAIL and CFPOP tags work, let’s take a look at a more complex example that showcases most features of both tags. In our example, we shall build a basic web-based email client. Before beginning, let’s outline the functionality and features we’ll need for the application. Remember, this is a basic email client with bare-bones functionality. We’ll need:

  • A login screen for users to enter POP server, SMTP server, email address, username, and password

  • A method for passing login information from template to template (in a relatively secure manner) without using persistent variables

  • An “Inbox” for listing all emails belonging to the user on the POP server with next/previous functionality

  • The ability to read a message and download any associated file attachments

  • The ability to forward a message to other recipients, including file attachments

  • The ability to reply to a message

  • The ability to create a new message and attach a file to that message

  • The ability to delete messages from the POP server

With the list of requirements for the application defined, let’s map out exactly how the application should flow. The application consists of three templates for handling all POP client functions. The first template, named PopForm.cfm, gathers login information for the POP server and posts to the Inbox.cfm template. The Inbox.cfm template creates the user’s inbox. The inbox consists of a list of the email messages in the user’s ...

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