Added many logs. Added send email only fro production.