Skip to content

feat(mailer): add ejs template handling

Hugo SUBTIL requested to merge feat/mail-sending into dev

Pour tester:

  • Variables a mettre dans le .env

MAIL_URL=https://sen.grandlyon.com/api/mail/send

MAIL_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2MDY4MDY4NTgsInVzZXJuYW1lIjoiUkFNIiwiZXhwIjoxOTIyMjA2ODU4fQ.ic75gDNzgMbB8PZ8w-5HseHwCGs-DSg_W4xtjB4HJIBqIve1wSFwJPt3DMQOu3EyObfmPqbvFFfEtjnESf5m-ZgdqGw7QglcMdw2R6Kt47h8jJ3b9kqI_zlUiiG4k-IZBJwJP7bMXel9g8LgLHgR-IB4ufG9NdP6vEHN1mz4TMMEihaVof6xgoUXhDMQQNf-LI9TzyHl4s7YPxNpYNLYM-jG2EmJ_zWyKpCGtolVjV_xEezA51h1ANJJucr4PWD75ostX4Iuy-kLqBmi3GMcu9bR90xqtZmvn4t6H8eybHGPjWPale767rn1jsBdFWIvkipe6dJrCroNFNDG4TNS9qnrMuDHwve0kCnpBarRrhbUrcEG548ujwkHRQaoC5e56zdvzDwB0pXf_rMzFhdN6eOwrLTbwaFlySYlOk7CpetKjbTCm-aGnKR1oaajOSiVu7Ee4xgpIGi6s22OqY09zCpqbumvpxb7TvsTpQMiiOOnSfDkOnYVZAcw1tPWWDWl_2lGOjy9BciIKUOKOypsyxzfS8G3MWaQDutOGhGJWOr6BQJMNoYu79u8kD23K_bV4ZoddiyGAJObYjc-g6fhg5sxt2A8MXFdP2zyP-3FkahFMZIf9S3pKSEE8gWn_D8WFJqSUH8oX7NGPbdWqc2ddBf1r5sIYqUyYytJpfCHth8

  • Methode de test:
private async verify() {

const ejsPath = this.mailerService.getTemplateLocation(this.mailerService.config.templates.verify.ejs);
const jsonConfig = this.mailerService.loadJsonConfig(this.mailerService.config.templates.verify.json);
const config = this.mailerService.config;

const html = await ejs.renderFile(ejsPath, {
config,
token: 'tmpTok3en',
});

this.mailerService.send('hugo.subtil@soprasteria.com', jsonConfig.subject, html);
}
Edited by Hugo SUBTIL

Merge request reports

Loading