-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mailer: In dev mode send emails in all locales #41879
Comments
/cc @cescoffier (mailer) |
@gbourant can you be more clear? Do you mean your Qute template run through all locales and sent? |
Yes, when you send an email and you are in dev mode, it should send it in all locales for debugging purposes. (maybe it should be enabled via a config option). So if you have defined 3 locales and you send a single e-mail, it should have sent 3 emails in 3 different locales. |
Well, i was thinking about that and i came up with this @ApplicationScoped
public class MailService {
@Inject
I18N i18n;
public void send(MailTemplate.MailTemplateInstance mailTemplateInstance, String emailType, String subjectKey, Object... params) {
if (LaunchMode.current() == LaunchMode.DEVELOPMENT) {
for (String locale : Globals.locales()) {
i18n.setForCurrentRequest(locale);
doSend(mailTemplateInstance, subjectKey, params);
}
} else {
doSend(mailTemplateInstance, subjectKey, params);
}
}
private void doSend(MailTemplate.MailTemplateInstance mailTemplateInstance, String subjectKey, Object... params) {
mailTemplateInstance
.subject(i18n.formatMessage(subjectKey, params))
.send()
.await()
.atMost(Duration.ofSeconds(10));
}
} |
I can say that if I were using Quarkus and came across this while developing, I would be very surprised at the behavior and perhaps annoyed of this default |
Yeap, it's ok. |
Description
When you are in dev mode, it would be nice if an email was sent in all locales defined in
quarkus.locales
.Implementation ideas
No response
The text was updated successfully, but these errors were encountered: