Displaying a Specific Message ColdFusion Help

In addition to displaying a list of messages in an inbox, it is useful to display the complete contents of a specific message. To do so, you want to use the GetA 11 value for the ACTION attribute of the CFPut’ tag.

Consider our previous example, in which the list of the contents of an inbox was displayed. In this example, the following CFPOP tag was used: <CFPOP SERVER-‘mail.domain.name’ USERNAME-‘userl’ PASSWORD-‘passl’ ACTION-‘GetHeaderOnly’ NAME-‘mail’)

Now, what changes need to be made to retrieve the entire contents of the second message in the inbox? First, the ACTION attribute should become ACTION'” GetA 11  Second, you need to use yet another attribute of the CFPOP tag: MESSAGENUMBER. With this attribute you can specify that you want to retrieve the second message by using MESSAGENUMBER” 2.

In ad&tion to the header fields that are returned with a CFPOP query when ACTION is set to GetHeaderOnly, an additional field containing the body’ (contents) of a message is returned when ACTION is set to GetA 11. This fielsi is named. BODY. Put all together, a page designed to display the contents of the second message in the preceding inbox example would look like Listing 22.2.

This code should produce results similar to those in Figure 22.2 by using CFPOP to connect to the server and retrieve the entire message (ACTION=” GetA 11 “) for the second message (MESSAGENUMBER=2). The retrieved message is placed in themai1 query variable, which is then used to output the message.

Posted on November 14, 2015 in Reading Mail

Share the Story

Back to Top
Share This