final sql template and emailing put in

put emailing in borrow and return