The Mail Log page displays details of the summary record selected in the just-completed Mailbox page. All information including the message and the list of recipients is included. A recordset is created from the MailMerge table by applying the requested record's ID as a filter. Step 1: Implement Mail Log Design A simple layout is all that's needed for this recipe. Here all the data fields are bound to the page as text elements, including the message body and BCC fields. Create a page from the File > New dialog or by deriving a page from a template. In the MailMerge folder, find the folder for your server model and open the maillog page. In the content area of your page, create a header for the page and an area for the email details. From the Snippets panel, drag the Recipes > MailMerge > Wireframes > Mail Log - Wireframe snippet into the Content editable region. Add labels for the following eight data fields: Email Type, Email Priority, From, To, CC, Subject, Body, and BCC. Place your cursor in the row below the words MAIL LOG and insert the Recipes > MailMerge > ContentTables > Mail Log - Content Table snippet [r8-10].
Figure r8-10. Save your page. Note Alternatively, you could use a text area form element to hold the message body. The data is bound to the form field in the same drag-and-drop manner; however, the text would be displayed in a set area where scrollbars are employed as needed. Step 2: Add Database Components In this step, we'll take the EmailID passed as a URL parameter in the previous page and use it to filter our recordset. The MailBox data table serves as the basis for our recordset. PHP users will need to follow up with some custom code to simulate the view used here. From the Bindings panel, choose Add (+) and select Recordset (Query). In the simple Recordset dialog, enter an appropriate name. Enter Maillog in the Name field. Select the desired data source connection. Choose Recipes from the Connection (Data Source) list. Choose the needed table. From the Tables list, select MailBox (mailbox for PHP). Leave the Columns option set to All. In the Filter area of the Recordset dialog, set the four Filter list elements like this: Leave the Sort option blank and click OK to close the dialog. PHP developers need to insert a little custom code to create the view programatically. In Code view, move to the top of the page, place your cursor after the PHP connection line that starts <?php require_once, and insert the following code: From the Snippets panel, insert the Recipes > MailMerge > CustomCode_PHP > MailMerge - Create Temporary Table snippet. Save your page when you're done. This code simulates an Access view and prepopulates the Mailbox table before the recordset information is retrieved. Step 3: Data Binding Process Our last step for this recipe and the MailMerge application is a drag-and-drop. With the recordset defined, all we need to do is insert data fields from the Bindings panel onto the page. From the Bindings panel, expand the Employees recordset. Place the desired data source fields onto the page: Drag the MailTypeText field next to the Email Type label. Drag the MailPriorityText field next to the Email Priority label. Drag the EmailFrom field next to the From label. Drag the EmailTo field next to the To label. Drag the EmailCC field next to the CC label. Drag the EmailSubject field next to the Subject label. Drag the EmailBody field to the line below the Body label. Drag the EmailBCC field in the line below the BCC (Mail Merge Email List) label. Save your page [r8-11].
Figure r8-11. The application is now complete and ready for testing and deployment. Testing a mass emailing application is bit tricky: you want to make sure everything is working properly, but you don't want to annoy your co-workers with too many trial messages. Begin your initial testing by targeting yourself and one or two others on your staff. After you're sure the basic email application is sound, address a larger group, but don't use a mission-critical message. After a few test mailings, check the mail log page and make sure you're getting all the data you need. Remember, these recipes are only a starting point for your own customization and application |