Skip to content
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

EmailInfo TemplateParameters are ignored #1342

Open
avifatal opened this issue Oct 6, 2018 · 6 comments
Open

EmailInfo TemplateParameters are ignored #1342

avifatal opened this issue Oct 6, 2018 · 6 comments
Labels
type: enhancement New feature or request

Comments

@avifatal
Copy link

avifatal commented Oct 6, 2018

Hi,
I think this is a bug.
I am setting the template params as the following: emailInfo.setTemplateParameters(Collections.singletonMap("name","test name"));
this is the body content emailInfo.setBody("<b>test ${name}</b>");
the email arriving is: <b>test ${name}</b> and not as expected <b>test name</b> ;

Could it be that TemplateParameters is ignored when no providing template path?

thanks

            EmailInfo emailInfo =
                    new EmailInfo(
                            customer.getEmail(),
                            "[email protected]",
                            "My subject",
                            "");
            emailInfo.setCaption("Subject");
            emailInfo.setFrom("[email protected]");
            emailInfo.setBodyContentType("text/html; charset=UTF-8");
            emailInfo.setBody("<b>test ${name}</b>");
            emailInfo.setTemplateParameters(Collections.singletonMap("name","test name"));
            try {

                this.emailService.sendEmail(emailInfo);
            } catch (EmailException e) {
                e.printStackTrace();
            }

@jreznot jreznot changed the title emailInfo TemplateParameters are ignored. EmailInfo TemplateParameters are ignored. Oct 6, 2018
@jreznot jreznot changed the title EmailInfo TemplateParameters are ignored. EmailInfo TemplateParameters are ignored Oct 6, 2018
@jreznot jreznot self-assigned this Oct 6, 2018
@jreznot jreznot added the type: enhancement New feature or request label Oct 6, 2018
@jreznot
Copy link
Contributor

jreznot commented Oct 6, 2018

Hi,

it is not a bug, template parameters used only if you provide template path. Body always inserted as is.

We could improve it in the future releases, but there are no concrete plans for now.

@jreznot jreznot added the easy label Oct 6, 2018
@avifatal
Copy link
Author

avifatal commented Oct 6, 2018

Ok. that's a little bit odd and misleading API (-:
But thank you!

@jreznot
Copy link
Contributor

jreznot commented Oct 6, 2018

Will at least add JavaDoc soon and document current behaviour there

@avifatal
Copy link
Author

avifatal commented Oct 6, 2018

Can create a pull request for this? The caption / subject should also be compiled with the object.

@jreznot
Copy link
Contributor

jreznot commented Oct 6, 2018

Sure, feel free to create PR!

@avifatal
Copy link
Author

avifatal commented Oct 6, 2018

PR: #1345

@jreznot jreznot removed the easy label Oct 6, 2018
@jreznot jreznot removed their assignment Oct 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants