Skip to content

Commit 8bc0925

Browse files
committed
chapter 01: extracting the creation of confirmation mail responsibility into his own place
1 parent 395c7e0 commit 8bc0925

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function confirmationMailFactory(templating, translator) {
2+
function createMessageFor(user) {
3+
const subject = translator.translate('Confirm your mail address');
4+
5+
const body = templating.render('confirmationMail.html.tpl', {
6+
confirmationCode: user.getConfirmationCode(),
7+
});
8+
9+
const message = new Message(subject, body);
10+
message.setTo(user.getEmailAddress());
11+
12+
return message;
13+
}
14+
15+
return {
16+
createMessageFor,
17+
};
18+
}
19+
20+
module.exports = confirmationMailFactory;

0 commit comments

Comments
 (0)