decode and format mail