> I am trying to make a WAP based email client using
> coldfusion.My problem is that i want the latest
> messages in my inbox of pop account to be displayed at
> the top. Though i think of doing it in a way but i feel
> it as adhoc n not a good way. What i intend to do is
> first retrieving all mail headers, rocording its
> count, then diaplaying these headers using CFLOOP (over
> query).. but this way i can get the latest mails n not
> the latest one on the top...(hope u r getting what i
> mean...(code is below).

You should be able to accomplish this by simply looping backwards instead of
forwards over the recordset. One thing that you'll have to watch out for is
limitations in the number and length of records you can display at a time.
For example, if your mailbox has too many messages, you won't be able to
display them all in one card. You'll need a next-n interface for that.
Here's an example next-n WAP interface, also for a mail client, which lists
contacts stored in a database:

<cfquery name="getaddresses" datasource="contacts"
        cachedwithin="#CreateTimeSpan(0,1,0,0)#">
        SELECT          LastName,
                                FirstName,
                                EMail
        FROM            Employee
        WHERE           EMail IS NOT NULL
        AND             EMail <> ''
        ORDER BY        LastName
</cfquery>

<cfparam name="URL.start" default="1">
<cfset numrecs = "5">

<cfheader name="Cache-Control" value="no-cache">        
<cfcontent type="text/vnd.wap.wml">

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//PHONE.COM//DTD WML 1.1//EN"
"http://www.phone.com/dtd/wml11.dtd">

<wml>

        <card>
                <p>
                <select name="sendto">
                        <cfoutput query="getaddresses"
startrow="#URL.start#" maxrows="#numrecs#">
                        <option value="#EMail#"
onpick="sendmail.cfm##msginfo">#LastName#, #FirstName#</option>
                        </cfoutput>
                        <cfif getaddresses.RecordCount gt (URL.start +
numrecs)>
                        <option value="more"
onpick="listaddr.cfm?start=<cfoutput>#Evaluate(URL.start +
numrecs)#</cfoutput>">More...</option>
                        </cfif>
                        <cfif URL.start gt 1>
                        <option value="back"
onpick="listaddr.cfm?start=<cfoutput>#Evaluate(URL.start -
numrecs)#</cfoutput>">Back...</option>
                        </cfif>
                </select>
                </p>
        </card>

</wml>

Also, when displaying the content of a message, you'll need to break it or
truncate it if it exceeds a certain length. I generally keep my decks from
exceeding 1200 characters.

> ONe more query i am having is  that
> "IS THERE A WAY TO KNOW JUST THE UNREAD MESSAGES IN UR
> POP MAIL?????". Since the memory is very less for wap 
> based devices, it becomes necessarry to optimize the 
> code n speed.

I'm not exactly an expert on POP3, but I don't believe that the POP server
tracks what messages have been requested in full. Your mail client will need
to be responsible for that. 

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to