Specifications

Finally we close the mailbox with imap_close() and return the array we have built. The
display_message() function can then display the messages fields in the form you can see in
Figure 27.6.
Viewing Message Headers
As you can see in Figure 27.6, there is a Show Headers button. This activates the show-headers
option, which adds the full message headers to the message display. If the user clicks this but-
ton, he will see output similar to that shown in Figure 27.7.
Building a Web-Based Email Service
C
HAPTER 27
27
BUILDING A
WEB-BASED
EMAIL
SERVICE
647
FIGURE 27.7
Using show-headers to see the full headers for this message will help a user to track down the source of the spam.
As you probably noticed, the event handling for view-message covers show-headers (and its
counterpart hide-headers) too. If this option is selected, we do the same things as before. But
in retrieve_message(), we also grab the full text of the headers, as follows:
if($fullheaders)
$message[‘fullheaders’] = imap_fetchheader($imap, $messageid);
We can then display these headers for the user.
33 7842 CH27 3/6/01 3:41 PM Page 647