This tutorial will show you how to create an email module that will
display to you how many emails you have in your inbox of any pop 3 account.

First we will create a database so that you can store multiple user info.


I will be using mysql for this example.

CREATE TABLE 'tbl_email_users' 
(
    'fld_emailid' bigint(20) NOT NULL auto_increment,
    'fld_pop' varchar(255) default NULL,
    'fld_emailuname' varchar(255) default NULL,
    'fld_emailpass' varchar(255) default NULL,
    'fld_emailactivate' varchar(4) default NULL,
    PRIMARY KEY ('fld_emailid'),
    KEY 'fld_userid' ('fld_emailid')
) TYPE=MyISAM

Now that we have our table made lets start by creating application.cfm

<cfquery datasource="#dsn#" name="emailinfo_query">
   
SELECT *
    FROM tbl_email_users
</cfquery>

Now lets set some vars inside the application.cfm page

<cfset emailinfo = emailinfo_query>

<cfparam name=
"popServer" default="#emailinfo.fld_pop#">
<cfparam name=
"popUsername" default="#emailinfo.fld_emailuname#">
<cfparam name=
"popPassword" default="#emailinfo.fld_emailpass#">

This query can become more complex as you incorporate it into your system.
But for this tutorial we will just act like there is only one user.

Now lets create the emailDisplay.cfm page.

<cfif emailinfo.fld_emailactivate is "Yes">

    <cfpop action=
"GETHEADERONLY"
                server=
"#popServer#"
                name=
"qGetMessages"
                username=
"#popUsername#"
                password=
"#popPassword#">

    <cfoutput>
    <table width="150" cellpadding="5" border="0" cellspacing="0">
        <tr>
            <td align=
"center"><b>Email</b></td>
        </tr>
        <tr>
            <td align=
"center"> You have<br>
                #qGetMessages.RecordCount#<br>
                Email (s) <br>
                <a href="index.cfm?sector=email&page=inbox">Read Email</a> 
            </td>
        </tr>
    </table>

    </cfoutput>
</cfif>

This is all there is to making your very own display module for your website.

Remember this is a very simple system. It can become very robust depending on 
how you setup your table structure.

About This Tutorial
Author: Jeremy Rottman
Skill Level: Beginner 
 
 
 
Platforms Tested: CFMX
Total Views: 40,766
Submission Date: March 15, 2005
Last Update Date: June 05, 2009
All Tutorials By This Autor: 3
Discuss This Tutorial
Advertisement

Sponsored By...
Powered By...