/[perl]/email_attachements.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /email_attachements.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dpavlin, Sat Feb 1 00:43:02 2003 UTC revision 1.2 by dpavlin, Sat May 10 15:06:17 2003 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3    # send same message and different attachements to people. Run this script
4    # without arguments to see usage, and customize message on top of script
5    #
6    # Dobrica Pavlinusic, http://www.rot13.org/~dpavlin/sysadmin.html
7    
8  use strict;  use strict;
9  use MIME::Lite;  use MIME::Lite;
10    
11    # customize this part !!
12    my $from = 'Joe Doe <joe.doe@nobody.com>';
13    my $subject = "New informations about...";
14    my $errors = 'postmaster@nobody.com';
15    my $body = "Please find attached more information about...";
16    # end of user configuration
17    
18  my %ext2mime;  my %ext2mime;
19    
20  open(MIME,"/etc/mime.types") || die "mime.types: $!";  open(MIME,"/etc/mime.types") || die "mime.types: $!";
# Line 23  my $curr_dir = shift @ARGV; Line 35  my $curr_dir = shift @ARGV;
35    
36  if (! $curr_dir) {  if (! $curr_dir) {
37          print "\nUsage: $0 [directory]\n\n";          print "\nUsage: $0 [directory]\n\n";
38          print "diretory should containt directories which are valid e-mail\n";          print "directory should containt directories which are valid e-mail\n";
39          print "addresses (like first.last\@pliva.com) and attachements inside\n";          print "addresses (like first.last\@pliva.com) and attachements inside\n";
40          print "that directory (directories without \@ will be ignored !!).\n";          print "that directory (directories without \@ will be ignored !!).\n";
41          print "All files in selected directory will be ignored.\n\n";          print "All files in selected directory will be ignored.\n\n";
# Line 64  foreach my $dir (@dirs) { Line 76  foreach my $dir (@dirs) {
76          closedir(DIR);          closedir(DIR);
77    
78          my $msg = new MIME::Lite(          my $msg = new MIME::Lite(
79                  From    =>'Zeljko Covic <zeljko.covic@pliva.hr>',                  From    => $from,
80                  To      => $dir,                  To      => $dir,
81                  Subject =>'Assessment Schedule',                  Subject => $subject,
82                  Type    =>'multipart/mixed');                  Type    =>'multipart/mixed');
83    
84          $msg->add('Errors-To' => 'Iva.Mladinic@pliva.hr');          $msg->add('Errors-To' => $errors);
85    
86          # debug          # debug
87          $msg->add('X-To' => $dir);          $msg->add('X-To' => $dir);
# Line 78  foreach my $dir (@dirs) { Line 90  foreach my $dir (@dirs) {
90          $nr++;          $nr++;
91    
92          attach $msg (          attach $msg (
93                  Type     =>'TEXT',                  Type     => 'TEXT',
94                  Data     =>"Please find attached more information about the assessment with relevant files included.");                  Data     => $body
95                    );
96    
97          foreach my $file (@files) {          foreach my $file (@files) {
98    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.26