function to send emails

create a function to send emails in controller "process report".