8 # * This file is free software; you can redistribute it and/or modify it
9 # * under the terms of the GNU General Public License as published by
10 # * the Free Software Foundation; either version 3 of the License, or
11 # * (at your option) any later version.
13 # * This program is distributed in the hope that it will be useful, but
14 # * WITHOUT ANY WARRANTY; without even the implied warranty of
15 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # * General Public License for more details.
18 # * You should have received a copy of the GNU General Public License
19 # * along with this program; if not, write to the Free Software
20 # * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # * Copyright 2007 Paul Mangan <paul@claws-mail.org>
25 # This script enables inserting files into the message body of a new Claws Mail
26 # Compose window from the command line. Additionally To, Cc, Subject and files
27 # to attach to the message can be specified
29 my (@inserts,@attachments,@lines,@output) = ();
37 GetOptions("to=s" => \$to,
39 "subject=s" => \$subject,
40 "attach=s" => \@attachments,
41 "insert=s" => \@inserts,
48 @attachments = split(/,/, join(',', @attachments));
49 @inserts = split(/,/, join(',', @inserts));
51 foreach my $attach (@attachments) {
52 $attach_list .= "$attach ";
55 foreach my $insert (@inserts) {
56 open(FILE, "<$insert") || die("can't open file\n");
58 push(@output, @lines);
62 foreach my $line (@output) {
66 $body = uri_escape($body);
68 system("claws-mail --compose \"mailto:$to?subject=$subject&cc=$cc&body=$body\" --attach $attach_list");
75 claws-mail-compose-insert-files.pl [options]
78 --to mail@address.net[,mail2@address.net]
79 --cc mail@address.net[,mail2@address.net]
80 --subject "My subject"
84 --attach and --insert can be used multiple times