Adds generatefinalmailtolink function for approval pane button
refactors test function