Made sure that emails are sent only while running in server environment.