comparison sendmail.pl @ 0:ee7ea1c2d01a draft

You must edit the sender email in the perl script after installation!
author geert-vandeweyer
date Wed, 08 May 2013 04:44:35 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:ee7ea1c2d01a
1 #!/usr/bin/perl
2
3 # load modules
4 use Getopt::Std;
5
6 ##########################
7 # COMMAND LINE ARGUMENTS #
8 ##########################
9 # u = (u)ser email from galaxy
10 # s = subject
11 # a = sample (a)nnotation
12 # g = sample (g)ender
13 # o = (o)utput file (simple text file)
14 getopts('u:s:o:d:', \%opts); # option are in %opts
15
16
17 if (!exists($opts{'u'})) {
18 die('no email specified');
19 }
20 $email = $opts{'u'};
21
22 if (exists($opts{'s'}) && $opts{'s'} ne '') {
23 $subject = $opts{'s'};
24 }
25 else {
26 $subject = "Galaxy Workflow or Job Finished\n";
27 }
28
29 # first compose message.
30 open OUT, ">mail.txt";
31 print OUT "to: $email\n";
32 print OUT "subject: $subject\n";
33 ## EDIT THE FROM EMAIL !!!
34 print OUT "from: ADMIN\@Your.Galaxy.org\n\n";
35 print OUT "Your Workflow on the Biomina Galaxy instance is finished. \n\n";
36 #print OUT "Access the results at : http://143.169.238.104/galaxy/\n";
37 if (exists($opts{'d'})) {
38 my @files = split(/@@@/,$opts{'d'});
39 print OUT "\n\nThe following datasets needed to be available before sending this notice:\n";
40 foreach (@files) {
41 $_ =~ s/^\s+//;
42 if ($_ eq '') {
43 next;
44 }
45 print OUT " - $_\n";
46 }
47 }
48 print OUT "\n\nPlease clean up unneeded datafiles, including hidden files (select 'show hidden').\n";
49 close OUT;
50 system("sendmail $email < mail.txt");
51 system("rm -f mail.txt");
52
53