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.
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.
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
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.