Sending email in a record action

Before class or in the function like shown in the below code: