MondoMail Mailing List Demo

This demo was created by Wayne Walrath and is provided free of charge to illustrate some of the potential for maintaining mailing lists within a database, and using Tango and MondoMail to manage those lists. The FileMaker Pro port was provided by Diana Oswald <diana@acmetech.com>. This demo only scratches the surface, but is meant to get you thinking.

Introduction

MondoMail is a simple, scriptable (through Apple events) daemon for sending SMTP mail. Demos of sending Email from AppleScript, Tango and FileMaker pro are provided with this package. MondoMail is provided absolutely free, but is Copyright 1996, 1997 by Acme Technologies. MondoMail is based on the MailTools gateway sources from John Norstad, portions Copyright Northwestern University. Please read the MondoMail READ ME document for full information on the license and credits.

This demo illustrates several concepts related to Tango and sending mail through MondoMail.

Implementation Notes

This demo includes databases and query documents for both FileMaker Pro and Butler SQL. We cannot provide assistance in setting up FileMaker, Butler, or Tango other than what is in the installation document that accompanies this demo. Please refer to the documentation and support programs for those programs if you are having problems. Please also recognize that MondoMail is provided As Is, and we cannot guarantee support for a free application, however we do appreciate feedback and bug reports, and attempt to reply promptly when sent Email. If you need custom development work done, or would like changes made to MondoMail, please contact Acme Technologies for information on consulting rates.

When you click the Send Message link from the Main Menu page, the data source is searched for all users, and an Email message form is created addressed to these users. Two <@ROWS> blocks are used in formatting this message, one for displaying the recipients, the other to set up a hidden INPUT field containing the comma-delimited recipient list. If you look at the Tango Action source for this procedure, you'll notice an <@IFEQUAL> block is used. The purpose of this is to keep from adding a comma after the last address in the records list. Here's what this looks like:


     <@ROWS><@COLUMN "users.email">
     <@IFEQUAL "<@CURROW>" "<@NUMROWS>"><@ELSE>,</@IF>
     </@ROWS>

The net effect of this is to add a comma after ever row from the search results, except when we reach the last record (<@CURROW> == <@NUMROWS>). For information on the <@CURROW> and <@NUMROWS> tags, refer to your Tango documentation. Another key point to notice is how we've avoided letting intervening spaces between records when formatting the recipient list. You'll have to view the Tango source to see this as it actually is, since the code above has been formatted for easier reading. MondoMail has certain rules related to specifying multiple recpients in the To:, Cc: and Bcc: fields. In particular, every address must be separated by a comma, and there should not be any spaces in between addresses (though spaces after a comma are handled correctly, spaces before a comma are not).

Why is formatting important? The answer to this question requires a little knowledge about how Tango performs the <@ROWS> substitutions. Tango copies everything between the opening <@ROWS> and the closing </@ROWS> tags for every row in the results set of records. If we didn't nestle the tags right next to one another, extra spaces would be added to the recipient list. If you find that you're having trouble sending Email to multiple recipients, turn debugging on in Tango and look closely at how you've formatted your Email addresses. Here's an example of a correctly formatted recipient list, and an incorrect one.

CORRECT

wkw@acmetech.com,sales@acmetech.com,support@acmetech.com
INCORRECT
wkw@acmetech.com   ,sales@acmetech.com  , support@acmetech.com

Saving State

The first time you submit the Send Email form, several of the values you entered are saved in globals (subject, SMTP gateway, and Sender's Address). The next time you go to send Email to all the recipients in the database, these values are put into the form automatically, provided you haven't quit Tango.acgi, and that your globals have not expired.

Query Document Organization

Since Tango does not yet support commenting your source code, it's important to make your Query Document actions as self-documenting as possible, and to adhere to some organizational principles. The MondoMail Mailing List Demo illustrates a few principles we use at Acme Technologies.

Globals
Name all your Tango globals with a lowercase "g", then capitalize the first letter of each word within the name. This makes it clear to anyone reading your code which variables are globals. For example: gSenderName, gSubject, gHostName.

Use a blank "No Operation" Action to separate functions
Start each discrete section of your Query Document with an empty No Operation Action and name it with beginning underscores. This serves two important purposes: 1) It makes locating the sections of your Query Document easier to find when viewing the actions in one of Tango's popup menus. The beginning underscores stand out from the rest of the actions. 2) by branching to this empty No Operation Action, you can always add additional actions to a part of your Query Document without having to go back to change one or more Branch Action destinations.

Default Behavior in Absence of Search_Args
When you use Tango's Builders to create Query Documents, bringing up the default Search or Insert form always requires specifying the search_args "function=form". We like to make the default menu page or form come up without having to specify this additional information. All this requires is simply returning this page if none of the Branc Actions are triggered. Clearly, this is not always desireable, but in many cases it is.

Closing Remarks

We hope that this demo has been useful, if for nothing else at least to illustrate using MondoMail with Tango.

Acme Technologies is a small team of developers with considerable experience in Web site development, CGI programming, database development and site hosting. We have been using Tango since the earliest days of its introduction, and have created dozens of sites for major clients, and even some turnkey systems built around Tango. Additionally, we sell and make available a number of products for Macintosh Internet servers.

If you need consulting, development or training in Tango, Butler, FileMaker Pro or other areas related to WWW/Internet development, please give us a call for rates and references or to talk about an upcoming project your company is planning. The Acme Technologies Web site is located at www.acmetech.com.


Return to Main Menu