Refactor the function of sending emails, and add two utilities of log writer and global config file reader.