Bug 12858: Add error handling to Syndetics Index
[koha.git] / misc / cronjobs / process_message_queue.pl
blobc79fea8452cba93e0be23ee6d88559f43d6c7bc7
1 #!/usr/bin/perl
3 # Copyright 2008 LibLime
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 use strict;
21 use warnings;
22 BEGIN {
23 # find Koha's Perl modules
24 # test carefully before changing this
25 use FindBin;
26 eval { require "$FindBin::Bin/../kohalib.pl" };
28 use C4::Letters;
29 use Getopt::Long;
31 my $username = undef;
32 my $password = undef;
33 my $method = 'LOGIN';
34 my $help = 0;
35 my $verbose = 0;
37 GetOptions(
38 'u|username:s' => \$username,
39 'p|password:s' => \$password,
40 'm|method:s' => \$method,
41 'h|help|?' => \$help,
42 'v|verbose' => \$verbose,
44 my $usage = << 'ENDUSAGE';
46 This script processes the message queue in the message_queue database
47 table. It sends out the messages in that queue and marks them
48 appropriately to indicate success or failure. It is recommended that
49 you run this regularly from cron, especially if you are using the
50 advance_notices.pl script.
52 This script has the following parameters :
53 -u --username: username of mail account
54 -p --password: password of mail account
55 -m --method: authentication method required by SMTP server (See perldoc Sendmail.pm for supported authentication types.)
56 -h --help: this message
57 -v --verbose: provides verbose output to STDOUT
59 ENDUSAGE
61 die $usage if $help;
63 C4::Letters::SendQueuedMessages( { verbose => $verbose, username => $username, password => $password, method => $method } );