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, Bcc, Subject and
27 # files to attach to the message can be specified
29 my (@inserts,@attachments,@lines,@output) = ();
38 GetOptions
("to=s" => \
$to,
41 "subject=s" => \
$subject,
42 "attach=s" => \
@attachments,
43 "insert=s" => \
@inserts,
50 @attachments = split(/,/, join(',', @attachments));
51 @inserts = split(/,/, join(',', @inserts));
53 foreach my $attach (@attachments) {
54 $attach_list .= "$attach ";
57 foreach my $insert (@inserts) {
58 open(FILE
, "<$insert") || die("can't open file\n");
60 push(@output, @lines);
64 foreach my $line (@output) {
68 $to = uri_escape
($to);
69 $cc = uri_escape
($cc);
70 $bcc = uri_escape
($bcc);
71 $subject = uri_escape
($subject);
72 $body = uri_escape
($body);
74 system("claws-mail --compose \"mailto:$to?subject=$subject&cc=$cc&bcc=$bcc&body=$body\" --attach $attach_list");
81 claws-mail-compose-insert-files.pl [options]
84 --to "Person One <mail@address.net>"
85 --cc "Person One <mail@address.net>"
86 --bcc "Person One <mail@address.net>"
87 --subject "My subject"
91 For multiple recipients separate the addresses with ','
92 e.g. --to "Person One <mail@address.net>,Person Two <mail2@address.net>"
93 --attach and --insert can be used multiple times