added pdf generation, added attach to email