Using beMegaphone

Version 0.7 (02/28/01)

Jean-Louis Villecroze Kirilla
What is Bemegaphone ?


beMegaphone is a simple list-server for BeOS that allow you to broadcast a newsletter or an announce by email to a list of recipients extracted from a text file, e.g from the log file of downloads from a web site.

The application is written in Squirrel (5.3 or higher) (you may download it on BeBits if you don't have it allready) and use the BeOS Mail Kit to send the emails (through the Mail Add-On of Squirrel).

Contents of this document

The main user interface


The user interface is composed of (from top to bottom) :
  • a menu
  • an area that allow you to enter the subject of the message and the type of the message
  • a multi-line text entry to type the content of the message
  • a status bar

Note that the application will remember it size and position on screen between session.


The menu Contents give access to the handling of the message contents :

  • Load will load a plain text file in the multi-line entry. An open FilePanel will be displayed to select the file
  • Save will save as a plain text file the content of the message. If the application don't know the file name, it will display a save FilePanel to select the file to overwrite or to create a new file
  • Save As will always ask you to select a file to overwrite or enter the name of a new file to create, to save the content of the message
  • New will erase the current message content and forget the name of the file (if it know of any from a previous load)
  • Quit will terminate the application

Note that the directory where the file was saved or loaded will be keep over session.

The menu Recipients allow to extract from a text file the list of the recipients :

  • Load will extract the recipients from a text file (according to the current settings). Then and only then will the two other items of the menu be available
  • Unload will remove the list of recipients, allowing you to select another file to load
  • Send from ... allow to set the email from which you wish to send the message. We will discuss this item later.

Note that the directory where the recipients file was loaded will be remembered over sessions.

The menu Send broadcast your message to the recipients:

  • Now will send the message(s) now, you must be connected to internet for the mail(s) to be send.
  • Later will create the message(s) and put them in the out folder of your Mailbox. Next time you are online, check your email and the message(s) will be send.

The first menu Application icon give access to the application settings and help:

  • Settings will display the application settings window
  • Help will start NetPositive and display this HTML document
  • About will display a standard About window.

You will have noticed in most of the screenshot, that some of the menu items are disable. They will be enable when needed.

Application Settings


Throught the Settings window, you can change some of the application settings to better fit your needs:

The Font box on the left allow you to set the font family and size of the text displayed in the Contents. The right box , Logfile parsing give access to the severals settings needed to parse the recipients file :

  • Field separator is the character that separate the differents informations on each recipient
  • E-Mail field is the field's position from where to extract the recipient's email
  • Announce field is the field's position from where the extract the wish of the recipient to receive announces
  • Newsletter field is the field's position from where the extract the wish of the recipient to receive newsletter
  • Recipient agree is what indicate in the logfile when the recipent agree to receive something (work for both newsletter and announce fields)

For now, thoses settings are probably a bit obscure, it will became more clear on the next part of this document.

The Blind Carbon Copy box allow to set the few settings about the BCC field. When this checkbox Use it to broadcast is checked, the entry field Recipients Pool's size will be enable and beMegaphone will broadcast using the BCC field. The pool size is the number of recipients to group on the same email using the bcc field.

When the checkbox Confirm to quit is checked, you will be asked to confirm each time you closing the application. The checkbox Add propaganda will add (when checked) a little ads banner at the end of your message saying :

--
Brought to you by beMegaphone (a BeOS application written in Squirrel)
--

Recipients file


beMegaphone parse a text file to extract the list of recipients. This text file must follow some rules. If your lists of recipients is to be parsed from a totaly different file, you will have to edit the source code of the application (fully readable) and adapt it to your need (or contact me).

The application is looking in the file for:

  • the recipient's email
  • the recipient's wish to receive an announce
  • the recipient's wish to receive a newsletter

The file must contain one line by recipient, and all the informations must be on that line. This line will be something like this one :

jean-louis villecroze|jlv@bemail.org|DR1|INTEL|yes|no|Mon Sep 6 11:58:49 1999|

In this example, the interesting fields are numbers : 2, 5 and 6 (from left to right). The separator characters of the field is | here, and the recipient agree when the field value 5 and 6 are yes.

A simplier example could be :

jlv@bemail.org,yes,yes

Here the fields will be 1,2 and 3, and the comma will be the field separator character.

Note that yes and no are the value that indicate if the recipient want your message or not.

In case you have more than one time the same recipient in your file, the application will always keep only the last occurence of it (for the preferences of newsletter/announce).

Filtering the recipients


If you get your recipients list from a download logfile, where the email adresses are freely entered, you have probably some invalides ones that will make your message to be bounced back at you. To avoid that, beMegaphone performe a sanity check on the recipients email before loading them.

This check is done by checking:

  • that the top-level domain name is a valid one
  • that the email is not in your banned list

Informations for the filtering are taken from two text files resident in the Datas directory of the application :

  • banned.txt contains the list of email you wish not to send messages to. Each line of the file can contains severals emails separated by a comma.

    e.g : sfsfsfdf@foo.com , apple@pie.oven , hello@there.wassup
  • domains.txt contains the list of valid top-level domain name. Each line of the file can contains severals domains separated by a comma.

Altought the Domains file will probably be not changed, you are invited to modify the Banned file to enter the incorrects emails for your list.

Sending the message


Once you have entered your message and loaded the list of recipients, it is time to broadcast it.

When you will have, throught the menu, initiated the sending process, the main window will be disabled (until it's over) and a status window will be displayed and updated:

  • Sending with the BCC field

    Using the BCC field is the faster way to broadcast your message.
  • Sending an email by recipients

    When sending to a lot of recipients (more than 50) thought a modem link, you will see that the application stop for often a long time an then continue. Be rassured, it's normal : the generation of the emails is way faster than the mail daemon can handle trought a slow modem link (e.g sending 561 emails trought a 28.8 connection take about 45 minutes).

If you aren't using the BCC field and that you are connected to Internet trought a modem link, if your link go down whiles sending the emails, you may have to restart the Mail daemon of BeOS. Then you will have to find which recipient was the last to receive your message and by setting the Start From ... email in the Recipients menu, resend the message starting from this recipient (the list of recipient is sorted in the application).

To abort (at anytime) the sending process, you can hit the ALT-C key over the status window (only when sending one email for each recipients).

Whatever way you broadcasting, you have to be very careful to disconnect from Internet, only when you are sure that all your emails have ben really sended. It's not because beMegaphone said that he is done, that the Mail server of BeOS is done. The safest way when sending to a lot of recipients is to check the /boot/home/mail/out to see that there's no more pending emails.

Hacking beMegaphone


One of the advantages of using a scripting language such as Squirrel is the way you can modify (hack) easily the script to better fit your needs or to extend it by adding new features.

All the source code of the application is fully readable and it can be found in the Sources directory. The main script is called beMegaphone and that's the file that Squirrel executes first.

To debug your hack, you will have to start the application from a Terminal in order to get any error message printed.

The application use the following scripts that contains various function and global variables:

  • Banned.sqi

    Parse the banned file and test if an email is banned

  • Currents.sqi

    Load and save some informations (such as window position)

  • Domains.sqi

    Parse the domains file and test if an email have a valid domain name

  • LogFile.sqi

    Parse the log file that contains the list of recipients

  • Main GUI.sqi

    Build the main GUI of the application and handle the menus

  • Settings.sqi

    Load and save the application settings

  • Settings GUI.sqi

    Build the Settings window

The main script performs :
  • load all thoses scripts and the needed Add-Ons
  • load the settings and currents
  • creates the application window
  • load the banned and domains files.
If you want to contribute to beMegaphone, please send me the changes you made to the various scripts files, and I will update and redistribute the new version (of course you will be credited for your help).

Support & Feedback


If you encounter troubles with this application, or if you have ideas on how to improve it, feel free to contact me.

Acknowledegments


Many thanks to the various peoples presents at BeGeistert 5 for the feedback during the presentation and workshop on Squirrel, and specialy to Scholly.

Version History


Release date Version Comments
02/28/01 0.7
  • Minor cosmetic changes
  • Adapted for Squirrel 5.3
10/28/00 0.5
  • Added settings Recipient agree
  • Added setting Recipients pool's size, removed Copist's Email
  • When the contents is saved throught Save As, the mime type of the file is set to text/plain
  • The application now handle errors
  • We no longer load the recipients that want to received nothing
  • Complete rewrite of the broadcasting with Blind Carbon Copy
10/23/00 0.4 Initial public release