- # check mail sending.
- my $queryMail = "
- SELECT suggestions.*,
- boby.surname AS bysurname,
- boby.firstname AS byfirstname,
- boby.email AS byemail,
- lib.surname AS libsurname,
- lib.firstname AS libfirstname,
- lib.email AS libemail
- FROM suggestions
- LEFT JOIN borrowers AS boby ON boby.borrowernumber=suggestedby
- LEFT JOIN borrowers AS lib ON lib.borrowernumber=managedby
- WHERE suggestionid=?
- ";
- $sth = $dbh->prepare($queryMail);
- $sth->execute($suggestionid);
- my $emailinfo = $sth->fetchrow_hashref;
- my $template = gettemplate("suggestion/mail_suggestion_$status.tmpl", "intranet", CGI->new());
-
- $template->param(
- byemail => $emailinfo->{byemail},
- libemail => $emailinfo->{libemail},
- status => $emailinfo->{status},
- title => $emailinfo->{title},
- author =>$emailinfo->{author},
- libsurname => $emailinfo->{libsurname},
- libfirstname => $emailinfo->{libfirstname},
- byfirstname => $emailinfo->{byfirstname},
- bysurname => $emailinfo->{bysurname},
- reason => $emailinfo->{reason}
- );
- my %mail = (
- To => $emailinfo->{byemail},
- From => $emailinfo->{libemail},
- Subject => 'Koha suggestion',
- Message => "".$template->output
- );
- sendmail(%mail);