diff -ubBrN com2/comas/examples/templates/icgtmp/committee/person_adm/person_list.tmpl com3/comas/examples/templates/icgtmp/committee/person_adm/person_list.tmpl
--- com2/comas/examples/templates/icgtmp/committee/person_adm/person_list.tmpl 2005-08-05 09:12:57.000000000 +0300
+++ com3/comas/examples/templates/icgtmp/committee/person_adm/person_list.tmpl 2005-08-05 19:57:34.000000000 +0300
@@ -95,6 +95,13 @@
+
+
diff -ubBrN com2/comas/examples/templates/icgtmp/committee/person_adm/send_mail.tmpl com3/comas/examples/templates/icgtmp/committee/person_adm/send_mail.tmpl
--- com2/comas/examples/templates/icgtmp/committee/person_adm/send_mail.tmpl 1970-01-01 02:00:00.000000000 +0200
+++ com3/comas/examples/templates/icgtmp/committee/person_adm/send_mail.tmpl 2005-08-05 19:58:05.000000000 +0300
@@ -0,0 +1,24 @@
+
+
+Send massive email
+
+
+The email has been sent succesfully
+
+
+
+
+
+
+Go back
+
+
diff -ubBrN com2/comas/examples/templates/icgtmp/mail/loc_message.tmpl com3/comas/examples/templates/icgtmp/mail/loc_message.tmpl
--- com2/comas/examples/templates/icgtmp/mail/loc_message.tmpl 1970-01-01 02:00:00.000000000 +0200
+++ com3/comas/examples/templates/icgtmp/mail/loc_message.tmpl 2005-08-05 19:55:01.000000000 +0300
@@ -0,0 +1,10 @@
+From: COMAS
+To:
+Subject: Message from the Local organizing committee
+
+----------------------------------------------------
+
+
+
+----------------------------------------------------
+
diff -ubBrN com2/comas/perl/Comas/HTML/committee/person_adm.pm com3/comas/perl/Comas/HTML/committee/person_adm.pm
--- com2/comas/perl/Comas/HTML/committee/person_adm.pm 2005-08-05 09:12:59.000000000 +0300
+++ com3/comas/perl/Comas/HTML/committee/person_adm.pm 2005-08-05 20:02:17.000000000 +0300
@@ -47,6 +47,7 @@
use Comas::Admin;
use Comas::Proposal;
use Comas::Person;
+use Comas::Conf qw(:read);
use Comas::HTML::common qw(:all);
use Comas::Lodging qw(get_rooms);
@@ -58,7 +59,7 @@
our @ISA = qw(Exporter);
our @EXPORT_OK = qw( person_adm_person_search person_adm_show_person
person_adm_modif_person person_adm_delete_person
- person_adm_print_nametags);
+ person_adm_print_nametags person_adm_send_mail _send_massive_mail);
our %EXPORT_TAGS = (all => [@EXPORT_OK]);
=head1 NAME
@@ -352,6 +353,75 @@
return $template->output;
}
+sub person_adm_send_mail {
+ my ($h, $template, $email);
+ $h = shift;
+
+ unless ($h->_ck_committee_task) {
+ return $h->committee_menu('NOT_AUTHORIZED');
+ }
+
+ $template = $h->new_template('committee/person_adm/send_mail.tmpl');
+ if ($h->{-params}{-mailto}) {
+ if (ref($h->{-params}{-mailto}) eq 'ARRAY') {
+ $email=join(',', @{$h->{-params}{-mailto}});
+ } else {
+ $email=$h->{-params}{-mailto};
+ }
+ } else {
+ $template->param(-emails => "");
+ return $template->output;
+ }
+ if ($h->{-params}{-mailto} and $h->{-params}{-message}) {
+ $h->_send_massive_mail($email, $h->{-params}{-message});
+ $template->param(-mail_sent => 1);
+ return $template->output;
+ } else {
+ $template->param(-emails => $email);
+ return $template->output;
+ }
+}
+
+
+sub _send_massive_mail {
+ my ($h, $template, $smtp_host, $mail_from, $smtp, $email, $message);
+ $h = shift;
+ $email = shift;
+ $message = shift;
+
+ unless ($h->_ck_committee_task) {
+ return $h->committee_menu('NOT_AUTHORIZED');
+ }
+
+ $template = $h->new_template('mail/loc_message.tmpl');
+ $template->param(from => get_conf($h->{-db},
+ 'attendees_recover_passwd_from'),
+ message => $message,
+ mail => $email);
+
+ $smtp_host = get_conf($h->{-db}, 'smtp_host') || '127.0.0.1';
+ unless($mail_from = get_conf($h->{-db}, 'attendees_recover_passwd_from')) {
+ warn "Couldn't get sender address, please check your configuration.\n";
+ return undef;
+ }
+
+ unless ($smtp = Net::SMTP->new($smtp_host)) {
+ warn "Couldn't contact SMTP server\n";
+ warn "The mail will not be sent.\n";
+ return undef;
+ }
+
+ $smtp->mail($mail_from);
+ $smtp->to($email);
+ $smtp->data();
+ $smtp->datasend($template->output);
+ $smtp->dataend();
+ $smtp->quit();
+ return 1;
+
+}
+
+
1;
=pod
diff -ubBrN com2/comas/perl/Comas/HTML.pm com3/comas/perl/Comas/HTML.pm
--- com2/comas/perl/Comas/HTML.pm 2005-08-05 09:12:58.000000000 +0300
+++ com3/comas/perl/Comas/HTML.pm 2005-08-05 20:00:24.000000000 +0300
@@ -533,6 +533,8 @@
return $h->person_adm_show_person($path[2]);
} elsif ($path[2] eq 'nametags') {
return $h->person_adm_print_nametags;
+ } elsif ($path[2] eq 'massive_mail') {
+ return $h->person_adm_send_mail;
} else {
return $h->person_adm_show_person($path[2]);
}