home *** CD-ROM | disk | FTP | other *** search
-
- MailBot Reference Manual - ASCII Version
- Freebieware © Tony Howat 1994, 1995
-
- v1.20 (26th Feb 1995)
-
- ---
-
- Mailbot is © Tony Howat 1994, 95 and is freebieware - i.e. distribution is
- unlimited, but :
-
- No charge may be made for this software,
- The software must be distributed as a complete package,
- The software should not be modified and distributed,
- Any handling fee charged by PD libraries must be nominal (<£1).
-
- FreebieWare[tm] also requires any commercial organisation using this
- program to send the author a freebie. Anything from a biro to a company
- car. Not only will you satisfy the conditions of FreebieWare[tm] but you
- will also gain some shameless advertising in future releases of MailBot.
- The address to send any freebies to is :
-
- Tony Howat
- 12 Dover Road
- Birkdale
- Southport
- Merseyside
- PR8 4SY
-
- Enquiries/suggestions/bug reports relating to MailBot should be e-mailed to
- thowat@xargle.demon.co.uk.
-
- To find out about the latest release of MailBot e-mail a blank message to
- mbv@xargle.demon.co.uk. Any new releases are announced on comp.sys.acorn
- and demon.ip.support.archimedes. The latest official release of
- MailBot is always availiable by FTP from ftp.demon.co.uk in
- pub/archimedes/developers.
-
- The Incredible Flying Frisbee Company is, of course, a fictional company;
- but you knew that, didn't you?
-
- ---
-
- CONTENTS
-
- - Introduction
-
- 1.0 What MailBot does
- 1.1 Features
- 1.2 Possible Applications of MailBot
-
- - Configuration
-
- 2.0 Command line parameters
- 2.1 How MailBot fits in with KA9Q & Debatchers
- 2.2 The Exclude file
-
- - Writing MailBot Scripts
-
- 3.0 Introduction to MailBot Scripts
- 3.1 Example MailBot script
- 3.2 Testing MailBot scripts
- 3.3 MailBot commands
-
- - Error Messages
-
- 4.0 General errors
- 4.1 Script Syntax errors
-
- ---
-
- 1.0 What MailBot does
- ~~~~~~~~~~~~~~~~~~~~~
-
- The Incredible Flying Frisbee Company, being the trendy organisation that
- they are, have an Internet connection, so all their customers can e-mail
- orders and find out about new products.
-
- T.I.F.F.C. use an Acorn machine running KA9Q to access their Demon account.
-
- One of the services tiffc.demon.co.uk offers is an information system,
- where customers can mail info@tiffc.demon.co.uk and information concerning
- T.I.F.F.C. products will be returned to them. Up until now this was run by
- hand, every request had to be replied to manually.
-
- Not any longer, for MailBot is here.
-
- Mailbot searches a mailbox, and sends a reply to every message in that
- mailbox containing a specified file. There are hundreds of possible uses
- for this simple function, and it acts as an invaluable replacement for
- finger on systems which are not on line 24hrs a day.
-
- ---
-
- 1.1 Features
- ~~~~~~~~~~~~
-
- Features
-
- Versatile script language
- Can send any number of messages in response to each request
- Can trigger other programs
- Can search any number of mailboxes
- Optional logging of requests to a file
- Mail loops prevented
- Header and footer files
- Exclusion facility for troublesome users
-
- Suggestions for new facilities are welcomed by the author, see the front of
- this manual for contact addresses.
-
- Details of the latest version of MailBot can be obtained by sending a
- message to mbv@xargle.demon.co.uk, and any new releases are announced on
- comp.sys.acorn.announce and demon.ip.support.archimedes.
-
- ---
-
- 1.3 Possible Applications of MailBot
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- • Making a document or program availiable on your system but keeping
- track of who has a copy.
- • Providing information on a company's products or services.
- • A fortune cooky server.
- • A substitute for finger for info on users (users of mailbot on a single
- user system should create an "aboutme" mailbot).
-
- ---
-
- 2.0 Command Line Parameters
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- The actual MailBot application is run in the form :
-
- mailbot <scriptfile> [-q(uiet)]
-
- Where <scriptfile> is the MailBot script to interpret. Appending "-q" to the
- mailbot command in the !Run file will suppress all non-essential messages.
-
- If no parameters are supplied Mailbot refers to the system variables
- MailBot$ScriptFile and MailBot$Options. In normal use these are set in
- the !MBotUser.!Options file. So, for silent running you load
- !MBotUser.!Options into a text editor, and insert a Q inbetween the quotes
- of the line setting MailBot$Options.
-
- ---
-
- 2.1 How MailBot fits in with KA9Q and debatchers
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- MailBot reads its input from <Mail$Dir>.spool.mail.text. This means
- !MailBot should be run before any debatchers such as !NewsBase or ka9q->rucp
- in your dialler script, that is, unless you can modify your debatchers to
- take their mail feed from a different directory to prevent them from
- debatching mail for !MailBot. Newsbase users can be modified to do this
- by loading the file "!NewsBase.transports.ka9q.params" and editing the
- line reading "in <Mail$Dir>.spool.mail.text.*" to "in Bot:User.OtherMail.*".
- Once this modification has been performed !NewsBase will not find any e-mail
- until after MailBot has been run, preventing any problems. The mail files
- are moved by a program called "MailCopy" in the !MBotUser directory, this
- is called by the Obey file "!Finished". You should edit "!Finished" and
- comment out the "<Obey$Dir>.MailCopy" line if you are not using NewsBase.
-
- Mail is sent by inserting directly into the SMTP queue in <Mail$Dir>.spool.
- mqueue.work/text.
-
- The relevant sections of my SlipDial script (based on Rob Orwin's) with the
- modifications for MailBot follow:
-
- #######################
- # Dial Demon and Log on
- :dodial
- set diff 4
- set tmstrt 0
- set tmend 0
- ## kill off newsbase so it won't debatch Mailbot's mail
- task /kill=“Newsbase”
-
- [*** Rest of :dodial unmodified ***]
-
- ###############################################
- # Call has been terminated, so release the port
- :terminate
- task /kill=“TCP/IP”
- message /close
- message “Call Terminated” /centre
- release
-
- # now pause for 1 second to allow RISC OS to sort out the display.
- pause 1
-
- # run MailBot *then* Newsbase.
- task “<Internet$Dir>.!MailBot.!Run”
- task “<Internet$Dir>.!Newsbase.!Run”
-
- #now trim DemHist File
- call trimfile <NNTP$Dir>.DemHist
-
- return 1
-
- The next, and most important stage of configuration is writing the script.
- The section three explains how to do this.
-
- ---
-
- 2.2 The Exclude File
- ~~~~~~~~~~~~~~~~~~~~
-
- The Bot:User.Exclude file should usually be non existant. It lists any users
- or groups of users you wish to prevent from using your mailbots. If a user's
- address matches a line in the Exclude file no responses are forwarded,
- and a note is made in the Log.
-
- Hopefully you won't have to resort to using the exclude file, but it would
- be extremely naive to suppose that everyone will be ultra considerate about
- your paying for their requests (assuming you're using a dial up connection
- and you're paying 8) ).
-
- Examples:
-
- "@vfuture.demon.co.uk"
- -- would ignore requests from john@vfuture.demon.co.uk,
- bob@vfuture.demon.co.uk, phantom@vfuture.demon.co.uk etc.
-
- "phantom@vfuture.demon.co.uk"
- -- would ignore requests from phantom@vfuture.demon.co.uk.
-
- "aol.com"
- -- would ignore all requests from America On Line subscribers.
-
- "x"
- -- would ignore all requests from addresses including the letter x.
-
-
- As you may have guessed if an address contains a string from the exclude
- list it is ignored. Both the Reply-to: and From: lines are checked.
-
- The list is dynamically allocated so you can exclude as many addresses
- as your wimpslot will allow.
-
- ---
-
- 3.0 Writing Mailbot Scripts
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- MailBot's scripting language is extremely simple, there are no user
- variables, comparative instructions or string handling functions etc.
-
- The MailBot Script Language centres around box..endbox structures. Most
- instructions work differently depending on whether they are used outside or
- inside one of these structures.
-
- Commands which set a value -----------------------------------------------
- The commands botbox, replyto, botnic, organisation, header, footer
- and title if used outside a box/endbox structure set a default value which
- is used if one is not explicitly defined inside a box...endbox structure,
- inside a box.. endbox structure these commands set the value locally, the
- value for each will return to the default at the endbox instruction.
-
- <commands here set default values for all blocks>
- block [mailbox name]
- <local copies of default values are made>
- <commands here alter local values>
- endbox
-
- Structural commands ------------------------------------------------------
- box...endbox structures cannot be nested, so the box instruction is
- invalid inside a box..endbox area, and the endbox command is invalid
- outside of a box..endbox structure. The end command can only be used in
- the main body of the program, not inside a box..endbox structure.
-
- Miscellaneous commands ---------------------------------------------------
- The run and logon commands can be used anywhere in the script, though
- logon should only really be called at the start of a script.
-
- Parameters ---------------------------------------------------------------
- Commands in MailBot Scripts need either one parameter (usually a
- string) or none. As a consequence of this no quotes are needed to enclose
- strings for passing to commands e.g.
-
- title "I love my frisbee"
-
- will produce a title line of :
-
- Subject: "I love my frisbee"
-
- Omitting the quotes in the subject statement will remove the quotes in the
- resulting Subject line.
-
- The send command ---------------------------------------------------------
- The send command only functions inside a box...endbox structure.
-
- Comments -----------------------------------------------------------------
- Comments may be inserted at any point in the code, by typing a hash (#)
- then the comment, but they should always be on a separate line to script
- statements e.g.
-
- # run program
- run ADFS::4.$.Foo
-
- is valid, but :
-
- run ADFS::4.$.Foo # run program
-
- will not work.
-
- The example script in the next section shows the script language being
- used in an (almost) real situation, which should help you understand what
- I'm going on about...
-
- ---
-
- 3.1 Example Script
- ~~~~~~~~~~~~~~~~~~
-
- A simple example script follows, which provides the following MailBots :
-
- three Returns an information message and two random cookies from
- the external program !CookieGen
- mailbot Returns a single information file (mailbot.info)
- mbv Returns a single information file (mailbot.version)
- aboutme Returns a single information file (aboutme.me)
-
- The script follows.
-
- # Global settings, used as defaults in
- # box definitions.
- # .----------------------------.
- botbox mailbot : These lines are outside of :
- thishost tiffc.demon.co.uk : the box definitions and so :
- botnic The TIFFC MailBot : they are used as defaults. :
- replyto fatbob@tiffc.demon.co.uk _: For example, any box which :
- organisation TIFFC <_ does not have its own :
- title Mailbot Request Results : title defined will use :
- logon : "Mailbot Request Results" :
- header MyHeader '----------------------------'
- footer MyFooter
- #
- # Box definitions.
- #
- box three
- title 1/3 About your request to the three MailBot.
- send three.info
- title 2/3 A random cookie from the three MailBot.
- run Internet:!CookieGen.!Run
- send cooky.cooky
- title 3/3 A random cookie from the three MailBot.
- run Internet:!CookieGen.!Run
- send cooky.cooky .-^--------------------------.
- endbox : This is a box definition :
- : structure. This box uses :
- box mailbot : the run command to trigger :
- title MailBot Information : a fortune cooky program :
- send mailbot.info '----------------------------'
- endbox
-
- box mbv
- title MailBot Version Information
- send mailbot.version
- endbox
-
- box aboutme
- organisation Cakes n' Lard
- title All about Fat Blobby Bob esq.
- send aboutme.me
- endbox
-
- end
-
- MailBot expects to find its script in the location given to it as the first
- command line parameter, by default the script file used is "Script" inside
- the !MailBot directory.
-
- ---
-
- 3.2 Testing MailBot Scripts
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- To test MailBot scripts you can either ask a helpful user to try your
- system, invariably wasting alot of phone calls, or you can test things
- locally.
-
- This may seem straightforward enough, you simply send a message to your
- own MailBot as you would any other message, but if you're using Newsbase
- & TTFN it's pretty difficult quitting Newsbase before it debatches the
- mail you've just sent and throws it at the postmaster. "mbst" (or MailBot
- Simple Tester) is a short program which works around this, creating test
- messages directly in the mailbox area ready for MailBot. Users
- of other mailers & debatchers may also find testing using "mbst" more
- convienient as you do not need to mess round with KA9Q as much to get
- the messages in the right place.
-
- Before you can use "mbst" you should configure it. Double click on
- !MBotUser and load the file "MBSTConfig". Alter the username & hostname
- to your own.
-
- To run the test program hold the right hand alt key down as you double click
- on !Mailbot. You will be prompted for a destination mailbot, type the name
- of the existing mailbot on your system which you wish to test, press return.
- The local message will be generated, and !Mailbot will be started immediately
- afterwards. The replies will now be in you mail queue, waiting to be sent
- back to you. You can either wait for these to echo back next time you log
- into demon, or you can run KA9Q, type "sm ga <your host name>" then "sm ki".
- Your responses from your mailbot will then be sorted into the mailboxes ready
- to be debatched.
-
- >> N.B. When setting yourself as the smtp gateway and kicking the queue you
- >> must make sure there are no messages for hosts other than your own
- >> in the queue, otherwise mail waiting to be sent onto the internet
- >> will arrive in local mailboxes on your system.
-
- ---
-
- 3.3 MailBot Commands
- ~~~~~~~~~~~~~~~~~~~~
-
- botbox -------------------------------------------------------------------
- Sets the e-mail address of a mailbot.
- Syntax
- botbox <address>
- Parameters
- <address> the e-mail address for the mailbot to
- respond as - i.e. the from address.
- Use
- Valid in or outside of a box definition
- Example
- botbox mailbot@tiffc.demon.co.uk
- Related Commands
- botnic, thishost, replyto
-
- thishost -----------------------------------------------------------------
- Sets the hostname of a mailbot.
- Syntax
- thishost <mailbox>
- Parameters
- <hostname> the hostname for the mailbot to use in SMTP
- headers.
- Use
- Valid in or outside of a box definition, but should
- always be set to the same hostname as KA9Q.
- Example
- hostname tiffc.demon.co.uk
- Related commands
- botnic, botbox, replyto
-
- replyto ------------------------------------------------------------------
- Sets the reply to address of a mailbot.
- Syntax
- replyto <hostname>
- Parameters
- <replyto> the reply for the mailbot to use in SMTP
- headers. This should be a valid address, and one
- which does not belong to a mailbot. Preferably it
- should be set to the Sysop's e-mail address, or the
- postmaster account on your system.
- Use
- Valid in or outside of a box definition.
-
- Example
- reply fatbob@tiffc.demon.co.uk
- Related commands
- botnic, botbox, thishost
-
- botnic -------------------------------------------------------------------
- Sets the textual name of a mailbot.
- Syntax
- botnic <name>
- Parameters
- <name> the name for the mailbot to use in SMTP
- headers alongside the from address set using botbox.
- Use
- Valid in or outside of a box definition, but should
- always be set to the same hostname as KA9Q.
- Example
- botnic My Little MailBot
- Related commands
- botbox, organisation
-
- organisation -------------------------------------------------------------
- Sets the text for the 'Organisation' line of the mail
- headers to address of a mailbot.
- Syntax
- organisation <text>
- Parameters
- <text> is the the to appear in the 'Organisation' line
- in the SMTP headers.
- Use
- Valid in or outside of a box definition.
- Example
- organisation The Software Factory
- Related commands
- None really.
-
- title --------------------------------------------------------------------
- Sets the title line for the next message (or the
- default if outside of a box definition) sent
- using the send command.
- Syntax
- title <text>
- Parameters
- <text> the text for the subject field for the next
- message sent.
- Use
- Valid in or outside of a box definition.
- Example
- box test
- title Test Mailbot
- send test.text
- endbox
-
- Related commands
- send, box, endbox
-
- box ----------------------------------------------------------------------
- Starts a mailbot box definition.
- Syntax
- box <mailbox>
- Parameters
- <mailbox> is the the mailbox name.
- Use
- Valid outside of a box definition - box/endbox
- structures cannot be nested. When inside a
- box/endbox structures title, organisation,
- replyto, botbox, botnic and thishost commands
- only act locally. Using these commands outside
- a box structure sets the defaults for when local
- values are not defined.
- Example
- box aboutme
- Related commands
- endbox, box, send.
-
- send ---------------------------------------------------------------------
- Sends a file in reply to all messages sent to
- a box.
- Syntax
- send <file>
- Parameters
- <file> is the filename of a text file in relation
- to Bot:User.Files.
- Use
- Valid inside of a box definition. There can be
- any number of send commands for each box segment.
- Example
- box test
- title Test Mailbot
- send test.text
- endbox
-
- ...will send the file Files.test.text from inside
- the !MailBot directory with the title "Test Mailbot"
- in reply to any message sent to the "test" mailbox.
- Related commands
- send, box, endbox
-
- endbox -------------------------------------------------------------------
- Ends a mailbot box definition.
- Syntax
- endbox
- Parameters
- No parameters.
- Use
- Valid inside a box definition, title,
- organisation, replyto, botbox, botnic and thishost
- commands return to their global default actions.
- Example
- endbox
- Related commands
- box, send.
-
- end ----------------------------------------------------------------------
- Ends the interpretation of a script.
- Syntax
- end
- Parameters
- No parameters.
- Use
- Only valid outside of box definitions, included for
- the sake of completeness, interpretation stops when
- the end of the file is met anyway.
- Example
- end
- Related commands
- endbox
-
- run --------------------------------------------------- altered in 1.20 --
- Runs an OS-CLI command or task.
- Syntax
- run <os-command>
- Parameters
- <os-command> is a standard operating system 'star'
- command.
- Use
- Valid inside or outside of a box definition.
-
- Typically used for altering data in files before
- they are sent.
-
- NEW IN V1.20 :
- When inside a box definition the run command is
- executed before every send command triggered by
- that box definition, when a run command is
- outside a box definition it is just executed
- once. For example, if you were triggering a cooky
- program and using 'run' and a user had sent two
- consecutive messages to the mailbot, the code :
-
- box cooky
- run Internet:!CookieGen.!Run
- title Words for the wise
- send cooky.cooky
- endbox
-
- ...would send a different cooky in response to
- the two messages, whereas :
-
- run Internet:!CookieGen.!Run
-
- box cooky
- title Words for the wise
- send cooky.cooky
- endbox
-
- ...would send the same cooky in response to
- the two messages.
-
- Example
- run Filer_OpenDir ADFS::4.$ -FullInfo
- Related commands
- None.
-
- logon --------------------------------------------------------------------
- Starts logging of requests to !Mailbot.Log.
- Syntax
- logon
- Parameters
- No parameters.
- Use
- Valid anywhere in a script, but it only makes sense
- to have this command at the start of the script
- before any box declarations.
- Example
- logon
- Related commands
- None.
-
- header -------------------------------------------------------------------
- Sets the filename of the header file to include
- before the text in later mailbot responses.
- Syntax
- header <header file>
- Parameters
- <header file> is the location of the header text
- file in relation to Bot:User.Files. As of v1.20
- "None" turns off this feature, no zero byte files
- are needed.
- Use
- Valid inside or outside of a box definition.
- Example
- header myheader
- Related commands
- footer, send.
-
- footer -------------------------------------------------------------------
- Sets the filename of the footer file to include
- before the text in later mailbot responses.
- Syntax
- footer <footer file>
- Parameters
- <footer file> is the location of the footer text
- file in relation to Bot:User.Files. As of v1.20
- "None" turns off this feature, no zero byte files
- are needed.
- Use
- Valid inside or outside of a box definition.
- Example
- footer myfooter
- Related commands
- header, send.
-
- ---
-
- 4.0/4.1 Error Messages
- ~~~~~~~~~~~~~~~~~~~~~~
-
- 4.0 General --------------------------------------------------------------
- "Couldn't write - possibly too many files"
- Failed to write a message into the mail queue, probably
- because the spool.mqueue.text/work directory is full.
-
- "Couldn't open sequence file"
- Sequence file spool.mqueue.sequence could not be read from or
- written to.
-
- "Can't open script file"
- The script file given to Mailbot as a parameter could not be
- read from.
-
- "Failed to open log file"
- Log file could not be open for write access.
-
- "Couldn't open header file <foo>"
- The file <foo> could not be opened.
-
- "Couldn't open footer file <foo>"
- The file <foo> could not be opened.
-
-
- 4.1 Script Syntax Errors -------------------------------------------------
- "Unknown command 'foo' in script"
- An invalid command was found in the script.
-
- "Badly placed 'end'"
- end command placed inside box structure, box definitions should
- be completed with endbox before and end command.
-
- "thishost only legal outside box definitions"
- ...so there.
-
- "Misplaced send command in script"
- Send command placed out of a box definition
-
- "Misplaced endbox in command script"
- An endbox command occurs in the script without a preceding
- send command.
-
- "box without endbox in script"
- Two consecutive box commands were met without an endbox
- command between them.
-
- "<value> was not set at send"
- An essential value had not been set before send was called,
- essential values being thishost, botbox, replyto and title.
-
- ---
-
- Manual written by Tony Howat
- Proof reading by David Norris
- © Tony Howat 1994,95