94
93
# After that, it looks over each user to see if they have schedules that need
95
94
# running, then runs those and generates the email messages.
97
# Send whines from the address in the 'maintainer' Parameter so that all
96
# Send whines from the address in the 'mailfrom' Parameter so that all
98
97
# Bugzilla-originated mail appears to come from a single address.
99
my $fromaddress = Param('maintainer');
101
if ($fromaddress !~ Param('emailregexp')) {
103
"The maintainer email address has not been properly set!\n";
106
# Check the nomail file for users who should not receive mail
108
if (open(NOMAIL, '<', "$datadir/nomail")) {
110
$nomail{trim($_)} = 1;
114
# get the current date and time from the database
115
$sth = $dbh->prepare('SELECT ' . $dbh->sql_date_format('NOW()', '%y,%m,%d,%a,%H,%i'));
117
my ($now_year, $now_month, $now_day, $now_weekdayname, $now_hour, $now_minute) =
118
split(',', $sth->fetchrow_array);
121
# As DBs have different days numbering, use day name and convert it
123
my $now_weekday = index("SunMonTueWedThuFriSat", $now_weekdayname) / 3;
98
my $fromaddress = Bugzilla->params->{'mailfrom'};
100
# get the current date and time
101
my ($now_sec, $now_minute, $now_hour, $now_day, $now_month, $now_year,
102
$now_weekday) = localtime;
103
# Convert year to two digits
104
$now_year = sprintf("%02d", $now_year % 100);
105
# Convert the month to January being "1" instead of January being "0".
125
108
my @daysinmonth = qw(0 31 28 31 30 31 30 31 31 30 31 30 31);
126
109
# Alter February in case of a leap year. This simple way to do it only
377
360
my $args = shift;
379
# Don't send mail to someone on the nomail list.
380
return if $nomail{$args->{'recipient'}->{'login'}};
361
my $addressee = $args->{recipient};
362
# Don't send mail to someone whose bugmail notification is disabled.
363
return if $addressee->email_disabled;
365
my $template = Bugzilla->template_inner($addressee->settings->{'lang'}->{'value'});
382
366
my $msg = ''; # it's a temporary variable to hold the template output
383
367
$args->{'alternatives'} ||= [];
409
393
$template->process("whine/multipart-mime.txt.tmpl", $args, \$msg)
410
394
or die($template->error());
412
Bugzilla::BugMail::MessageToMTA($msg);
396
Bugzilla->template_inner("");
414
399
delete $args->{'boundary'};
415
400
delete $args->{'alternatives'};