Change mail_handler logic