Can't set dynamic from/replyTo
CHANGELOG: we have replaced [replyTo] argument for [language] argument.
Why?
Since controller.mail returns instance of MailMessage https://docs.totaljs.com/latest/en.html#api~FrameworkMail You can do following:
var message = controller.mail(...);
message.to(...);
message.reply(...);
It's all in the docs https://docs.totaljs.com
@molda but the function executes sending it self. So the parametrs will be set after sending happened? Or sending is done after controller function is done?
Hi @trsh,
email is sent in the next tick. For understanding:
var message = controller.mail(...);
// This hidden code will be executed in the next tick
setImmediate(function() {
message.send();
});
// Your code:
message.to('...');
message.replay('...');
Why language? Because framework can localize subject and body automatically and this change was the only way how to do it.
var msg = controller.mail('[email protected]', '@(This subject will be localized with the view automatically)', 'view_name', model, model.language || '');
msg.reply('[email protected]');
Thank you!
@petersirka cool. Thanks for explanation ;)