Added generateCsr and updated sendEmail