How to send submission emails based on a condition?