implemented send-email function