create databases and implement mail function

create databases and implement mail function but the performance of
mail function need to be improve next