-
Notifications
You must be signed in to change notification settings - Fork 15
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
MultiTemplateContent fails with EmailVariant.TEXT, EmailVariant.HTML and Freemarker #52
Comments
Hello, I ran the sample HtmlAndTextTemplateSample (v1.1.1) and it works as expected. Which version are you using ? |
It's really peculiar. In a cut-down test it works, embedded in our app it doesn't.
That works. This doesn't:
|
I'm trying to imagine what would cause I hope it's not a red herring from the Thymeleaf support. Firing up the debugger again... |
The |
If I use the debugger to hack the templateName in Well, by "works" I mean it doesn't fail; we see the SMPP session being logged in INFO. Not actually receiving any SMS yet... |
I tried your code with simple Freemarker templates and everything works fine. For SMS, only a single template can be used so variants are useless and you have to provide the full extension ( Unfortunately, I can't reproduce your bugs... For the record, you don't need to use ogham.send(email.content(new MultiTemplateContent("classpath:/templates/messaging/" + message.get("_template"), message))); Or even better, instead of using a map, you could use directly a domain object. |
Ah! I missed that the SMS version uses the full template name, with extension. I think that's the remaining issue for us. The MultiTemplateContent is now working for the email case...I think the mvn:clean fixed it. Unfortunately a domain object for the context isn't an option, because we'll be using user-supplied templates and contexts. But I'll experiment with dropping SimpleContext. Thanks for your help! |
We're trying to use
MultiTemplateContent(...EmailVariant.TEXT, EmailVariant.HTML)
with two Freemarker templates:testAlertEmail.html.ftl
andtestAlertEmail.txt.ftl
.Using the HTML variant alone works fine, but when we enable TEXT, we see the call to
impl.getDetector().canParse(templateName, ctx)
in AutoDetectTemplateParser.java:46 with atemplateName
oftestAlertEmail.txt
instead of the expectedtestAlertEmail.txt.ftl
.This results in a return of
false
forcanParse
so we end up withFailed to automatically detect parser due to detection error
.The text was updated successfully, but these errors were encountered: