Re: Combining actions with templates?

Peter Davis <[email protected]> Sat, 29 Mar 2003 12:47:51 -0500
Newsgroups gmane.mail.sylpheed.claws.windows
Message-ID <[email protected]>
On Sat, 29 Mar 2003 08:52:51 +0100
Thorsten Maerz <[email protected]> wrote:

> 
> Hi Syafril,
> 
> On Sat, 29 Mar 2003 12:12:42 +0700 Syafril Hermansyah <[email protected]> wrote:
> 
> > On Fri, 28 Mar 2003 16:49:47 -0500 Peter Davis (PD) wrote:
> > 
> > > I want to run
> > > a perl script to parse the subject line to get the email address, and
> > > then automatically put that in the 'To:' field of an outgoing message
> > > which uses a template.  So in a sense, I want the 'To:' field of the
> > > template to be filled in with the output of an action.
> > 
> > All current version of sylpheed doesn't have feature to call Template
> > Name.
> 
> As a workaround, you can call 'sylpheed --compose "[email protected]"' from
> inside the action script to open the compose window with the address
> filled in and insert a template afterwards.

Ok, so 

1) I have a message selected in the summary area, and it's displayed
   in the message area, and

2) I have an action defined as "| perl myscript.pl" (see below), then

does the perl script get the whole message, including the header
parts?  Because my script doesn't seem to be able to find the
"Subject:" line to parse out the applicant's email address.

Here's the (test) script I'm using:

#!/usr/bin/perl
#
# nescbwi.pl
#
# Send a message to the email address of the person applying
# to join the NESCBWI mailing list.
#
# pfd = Peter Davis, [email protected]
#
# History:
#  2002/12/23 pfd  First pass.
#
$home = $ENV{'HOME'};
$temp = $ENV{'TEMP'};
my $wannabe = "";
while (<>) {
    ($hdr, $val) = split(/:/);
    if ($hdr eq "Subject") {
        $val =~ s/.*\s<?([^\s]+@[^\s>]+)>?.*/$1/;
        print "Applicant: $val\n";
        $wannabe = $val;
    }
}
chop $wannabe;
($uname, $domain) = split(/@/, $wannabe);

# Check the user's name ...
print "Hi, $wannabe!\n";
system("\"C:\Program Files\Sylpheed-Claws\bin\sylpheed.exe\" --compose \"$wannabe\"");



-- 
--------
                             Peter Davis
               Funny stuff at http://www.pfdstudio.com
    List of resources for children's writers and illustrators at:
                  http://www.pfdstudio.com/cwrl.html


-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en