beginning to create the generic mail function