add register function
Mail function
ref
register function.