matcornic / hermes

Golang package that generates clean, responsive HTML e-mails for sending transactional mail

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Customisation of 'Action Trouble Text'

fridolin-koch opened this issue · comments

Currently I can't find any possibility to change the 'action trouble text' inside the footer:

If you’re having trouble with the button 'Hier Anmelden', copy and paste the URL below into your web browser.

This makes it impossible to fully customise the email template (e.g. i18n).

I would propose the following changes: fridolin-koch@44be377

I've you are happy with the proposed solution, I can sent a PR.

Best Regards,
Frido

Hey @fridolin-koch ,

Thanks for your message, it's a nice idea ! Implementation looks great to me, I see a little edge case though.
Code does not check that user set a single %s when he overrides his troubletext string. The user may get weird behaviour without knowing it, because the email template expects a parameter to the printf function.

On top of that, we would just need more additions for the PR, could you:

  • Update README.md with the new feature
  • Update CONTRIBUTING.md with the new feature

Thank you :)

I agree, I can think of two possible solutions.

  1. Check if the string contains %s exactly once, but this may also lead to unexpected behaviour in case the string contains %d %b etc.

  2. Define a custom placeholder like {ACTION} and replace with the action button text.

I think solution 2. would be less error prone. What do you think?

I agree, let's go for the second solution ;)

I've created a PR (#8), let me know if anything is missing :)

closed with #8