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