sqlw_mail - send mail with data from an SQLite table.
sqlw_mail --help | --manpage | --version
sqlw_mail --database database_file ( --email_col
column | --email_address address ) [ --limit number ] [
--mailer string ] { --not_where colname=1 } [ --page
number ] [ --row_template template ] { --show colname }
{ --sort_by colname } { --sort_reversed colname=1 } [
--subject string ] --table table { --where
colname=string }
This sends emails; one email for each matching row from the given table in the
given database.
- --email_address
- An array of email addresses to send the email to. If this is given, this
will send an email for each matching row, to each address in the array.
Useful for broadcast mailing.
Give either this option or the 'email_col' option.
- --email_col
- The name of the column to take email addresses from. If this is given,
then each row is sent to the email address value in that column for that
row. Useful for individual notification.
Give either this option or the 'email_address' option.
- --database
- The name of the database file to use. (required)
- --help
- Print help message and exit.
- --index_template
- Similar to the report_template, but this is used for the index-pages in
multi-page and split reports. It has the same format, but it can be useful
to have them as two separate templates as one may wish to change the way
the title is treated for indexes versus actual reports.
- --limit
- The maximum number of rows to display per page. If this is zero, then all
rows are displayed in one page.
- --manpage
- Print the full help documentation (manual page) and exit.
- --not_where
- A hash containing the column names where the selection criteria in where
should be negated.
- --page
- Select which page to generate, if limit is not zero.
- --row_template
- The template for each row. This uses the same format as for headers. If
none is given, then a default row_template will be generated, depending on
which columns are going to be shown (see show).
The format is as follows:
- {$colname}
- A variable; will display the value of the column, or nothing if that value
is empty.
- {?colname stuff [$colname] more stuff}
- A conditional. If the value of 'colname' is not empty, this will display
"stuff value-of-column more stuff"; otherwise it displays
nothing.
{?col1 stuff [$col1] thing [$col2]}
This would use both the values of col1 and col2 if col1 is not
empty.
- {?colname stuff [$colname] more stuff!!other stuff}
- A conditional with "else". If the value of 'colname' is not
empty, this will display "stuff value-of-column more stuff";
otherwise it displays "other stuff".
This version can likewise use multiple columns in its display
parts.
{?col1 stuff [$col1] thing [$col2]!![$col3]}
- --show
- An array of columns to select; also the order in which they should be
shown when a row_template has not been given. If this option is not used,
all columns in the table will be shown.
- --sort_by
- An array of column names by which the result should be sorted. (Repeat the
argument for each new value)
- --sort_reversed
- A hash of column names where the sorting given in sort_by should be
reversed.
- --subject
- A template (as for row_template) of the Subject: line of the emails.
- --table
- The table to report on. (required)
- --verbose
- Print informational messages.
- --version
- Print version information and exit.
- --where
- A hash containing selection criteria. The keys are the column names and
the values are strings suitable for using in a LIKE condition; that is,
'%' is a multi-character wildcard, and '_' is a single-character wildcard.
All the conditions will be ANDed together.
Yes, this is limited and doesn't use the full power of SQL,
but it's useful enough for most purposes.
Getopt::Long
Pod::Usage
Getopt::ArgvFile
SQLite::Work;
perl(1) Getopt::Long Getopt::ArgvFile Pod::Usage
Please report any bugs or feature requests to the author.
Kathryn Andersen (RUBYKAT)
perlkat AT katspace dot com
http://www.katspace.com
Copyright (c) 2005 by Kathryn Andersen
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.