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 ...
Get Programming ColdFusion now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.