Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Adobe Creative Suite

  • Print
  • + Share This
This chapter is from the book

The Back-End: Java

Email Services are reliant on the server to handle the sending, receiving, viewing, and deleting of the email. Let's look at an overview of the transaction data happening between the Flash front-end and the server.

Processing the Send Request

The XML request and response for sending email are identical to those found in the address book services section.

Processing the Received Request

This request is broken up into two stages: the folders request and the messages request. Here is an example of what Joe would send to the server to request his folder listing:

<Request>
   <TransactionType>GetFolders</TransactionType>
   <Data></Data>
</Request> 

And this is an example of a successful response:

<Response>
   <Status>Success</Status>
   <Data>
     <Folders>
        <Folder ID="3">
          <Name>Inbox</Name>
       </Folder>
     </Folders>
   </Data>
</Response> 

Assuming Joe received a successful response, he clicks on the folder that has now appeared and initiates the messages request:

<Request>
   <TransactionType>GetMessagesInFolder</TransactionType>
   <Data>
     <Folder ID="3"/>
   </Data>
</Request> 

And this is an example of a successful response:

<Response>
   <Status>Success</Status>
     <Data>
        <Messages>
          <Message ID="5" New="True" ReceiveDate="2002-
           09-18" HasAttachments="False">
            <Subject>Hello there Joe!</Subject>
          </Message>
        </Messages>
   </Data>
</Response> 

Processing a View Request

When Joe decides to view a message, he clicks on a message in the listbox to fire off the Message request to the server:

<Request>
   <TransactionType>GetMessageDetails</TransactionType>
   <Data>
     <Message ID="5"/>
   </Data>
</Request> 

Assuming the process is successful, the following document is returned:

<Response>
   <Status>Success</Status>
   <Data>
     <Message ID="5" ReceiveDate="2002-09-18">
        <Subject>Hello there Joe!</Subject>
        <Body>Joe! You're the best! Love, Lara</Body>
        <Attachments>
        </Attachments>
     </Message>
   </Data>
</Response> 

Processing the Deletion Request

Recall how the deletion did not have a callback function. In the case of the deletion request, the document is sent to the server, and the server communicates to the database to remove the specified record. Here is an example of the XML request:

<Request>
   <TransactionType>DeleteMessage</TransactionType>
   <Data>
     <Message ID="5" />
   </Data>
</Request> 

The Database

The three tables that are primarily affected by the Email Services of Peachmail are Folders, Messages, and Attachments.

Prior to the receive email request, the server first retrieves data from the Folders table correlating to a specific user ID and sends it back to Flash. Then when the user clicks on a folder, the server pulls data from the Messages table for the specific folder ID and sends the message listing back to Flash.

When the user clicks on a message to view it, the server requests data from the Messages table correlating with the specific message ID. The Attachments table is queried as needed, if there are any attachments accompanying the message.

Deleting a message involves the removal of the message from the Messages table. The attachments specific to the request are also removed.

  • + Share This
  • 🔖 Save To Your Account