implemented register doc and send email