Changeset 417 for LATMOS-Accounts/lib
- Timestamp:
- 09/03/09 17:31:29 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts/Maintenance.pm
r413 r417 40 40 } 41 41 42 =head2 warn_next_expire_users(%options) 43 44 Send a mail to user having account expiring soon 45 46 C<%options are> 47 48 =over 4 49 50 =item users => [] 51 52 Warn only this users (if need) 53 54 =item to 55 56 Send the only to this person. 57 58 =back 59 60 =cut 61 42 62 sub warn_next_expire_users { 43 my ($self ) = @_;63 my ($self, %options) = @_; 44 64 45 65 require Mail::Sendmail; … … 52 72 ); 53 73 foreach my $user ($self->find_next_expire_users) { 74 if ($options{users} && ! grep { $_ eq $user->{name} } @{$options{users}}) { 75 next; 76 } 54 77 my %mail = ( 55 78 From => ($self->val('_default_', 'mailFrom') || … … 69 92 my ($to, @cc) = grep { $_ } ($mail, $managermail, $self->val('_default_', 70 93 'allwayscc')); 71 $mail{to} = 'nanardon@nanardon.zarb.org'; 72 94 if ($options{to}) { 95 $mail{to} = $options{to}; 96 } else { 97 $mail{to} = $to; 98 $mail{cc} = join(', ', @cc); 99 } 100 $mail{to} or next; 73 101 my $message; 74 102 $template->process('account_expire.mail', $user, \$message) 75 103 or die $template->error(); 104 76 105 if (Mail::Sendmail::sendmail( 77 106 %mail, 78 107 Message => $message, 79 108 )) { 80 warn "mail sent to " . ($to || '') . " cc " . (join(', ', @cc) || '') . "\n"; 109 printf("Mail normally set to %s; cc to %s\n", 110 $to, (join(', ', @cc) || '')); 81 111 } else { 82 112 warn $Mail::Sendmail::error
Note: See TracChangeset
for help on using the changeset viewer.