Mercurial > repos > geert-vandeweyer > sendmail
view sendmail.pl @ 1:0b1cdae7ad5b draft
Uploaded
author | geert-vandeweyer |
---|---|
date | Wed, 08 May 2013 04:45:00 -0400 |
parents | ee7ea1c2d01a |
children |
line wrap: on
line source
#!/usr/bin/perl # load modules use Getopt::Std; ########################## # COMMAND LINE ARGUMENTS # ########################## # u = (u)ser email from galaxy # s = subject # a = sample (a)nnotation # g = sample (g)ender # o = (o)utput file (simple text file) getopts('u:s:o:d:', \%opts); # option are in %opts if (!exists($opts{'u'})) { die('no email specified'); } $email = $opts{'u'}; if (exists($opts{'s'}) && $opts{'s'} ne '') { $subject = $opts{'s'}; } else { $subject = "Galaxy Workflow or Job Finished\n"; } # first compose message. open OUT, ">mail.txt"; print OUT "to: $email\n"; print OUT "subject: $subject\n"; ## EDIT THE FROM EMAIL !!! print OUT "from: ADMIN\@Your.Galaxy.org\n\n"; print OUT "Your Workflow on the Biomina Galaxy instance is finished. \n\n"; #print OUT "Access the results at : http://143.169.238.104/galaxy/\n"; if (exists($opts{'d'})) { my @files = split(/@@@/,$opts{'d'}); print OUT "\n\nThe following datasets needed to be available before sending this notice:\n"; foreach (@files) { $_ =~ s/^\s+//; if ($_ eq '') { next; } print OUT " - $_\n"; } } print OUT "\n\nPlease clean up unneeded datafiles, including hidden files (select 'show hidden').\n"; close OUT; system("sendmail $email < mail.txt"); system("rm -f mail.txt");