Menu

#5 Use of email subjects in scripts

open
nobody
None
5
2008-08-20
2008-08-20
feld
No

I use this to give me the usage of email subjects in scripts. What I actually do is hook into my email to SMS gateway perl script so I get a text message on my phone when I get a new email. :)

diff -urN checkgmail /usr/bin/checkgmail
--- checkgmail 2008-08-19 22:02:19.000000000 -0500
+++ /usr/bin/checkgmail 2008-08-19 21:56:43.000000000 -0500
@@ -1275,6 +1275,12 @@
my $messages = @messages;
$command =~ s/\%m/$messages/g;
}
+
+ # allows you to use the email's subjects in scripts
+ if ($command =~ m/\%t/) {
+ my $emailsubjects = join(' | ', map { $_->{title} } @messages);
+ $command =~ s/\%t/$emailsubjects/g;
+ }

print "run command: $command\n" unless $silent;
system("$command &");

Discussion


Log in to post a comment.