Update the environment
Add a condition
Fix the mail sending