Project

General

Profile

notification e-mail's content change

Added by Péter Kiss over 13 years ago

Hi,

I would like to change the content of notification e-mails in Redmine, but I don't know how it is possible.
I would like to have similar to the following message in the emails in Hungarian:

"Hi,
This e-mail was generated by Redmine, because the following data changed:

-----------------
ABOUT THE UPDATE
-----------------
Project: [project name]
Issue: [Issue name] (Or wiki's or forum's)
who did update: [name]
Link: [hyperlink]

The update:
[Update]
----------------------
ALL INFORMATION ABOUT THE ISSUE
----------------------
Issue: [Issue name] (Or wiki's or forum's)
Added by [who] and [when]

Status: [status]
Priority: [priority]
Assigned to: [assigned to]
Category: [category]
Target version: [t.version]
Start: [start]
Due Date: [due date]
Done: [done] %
Spent time: [spent time]

Description:
[DESCRIPTION]
----------------------
[Email footer from settings]
"

1) How can I do it?
I found two files, but I'm not sure wheter these are the ones that I have to use... Furthermore, I don't how to modify them. ([app/models/mailer.rb] and [app/views/layouts/mailer.text.plain.rb])

I tried to write the first lines in [mailer.text.plain.rb] before "<%= yield %>" It has worked, however the special characters (like á, é, ő) can be seen like this: �

2)Can I change the plain text to html? Could you help me how can I do that? And If it is possible, could you help me also how to change its content?

Please help me where I can find information about these questions!

Thank you in advance!
Peter


Replies (3)

RE: notification e-mail's content change - Added by Felix Schäfer over 13 years ago

  1. You will probably want to make a plugin for that, that should save you some headaches with future updates,
  2. You can easily override views in a plugin, just put them in the same path as the original in the plugin (hence vendor/plugins/my_plugin/app/views/mailer/issue_add.text.html.rhtml will override app/views/mailer/issue_add.text.html.rhtml),
  3. All Mail "views" are in app/views/mailer/, on issue creation, issue_add is sent, on issue update it's issue_edit and so on, the extension should tell you well enough about whether it's the text or the html part (beware: html mails are multipart and contain the text part too),
  4. The app/views/layouts/mailer.text.plain.rb and app/views/layouts/mailer.text.html.rb are respectively the text and html layouts for all mails,
  5. About the special chars: make sure you edit the files as UTF-8.

RE: notification e-mail's content change - Added by Péter Kiss over 13 years ago

Thank you, Felix!

What you wrote, it’s OK. It's working.

But I don't know how should I exactly modify the content of issue_edit.text.plain.rhtml, I've never done anything like that before.
For example: how and where can I modify the script to have this line ("Spent time: [spent time]") below the issue's details in the e-mail?
So how can I use the variables, how should I modify the script to look like this:

Project: [project name]
Issue: [Issue name]
who did update: [name]
Link: [hyperlink]
The update:
[Update]
----------------------
Issue: [Issue name]
Added by [who] and [when]
Status: [status]
Priority: [priority]
Assigned to: [assigned to]
Category: [category]
Target version: [t.version]
Start: [start]
Due Date: [due date]
Done: [done] %
Spent time: [spent time]
Description:
[DESCRIPTION]

Thanks!

RE: notification e-mail's content change - Added by Felix Schäfer over 13 years ago

Well, I won't do the work for you and you should read about rhtml/erb on your own, but suffice to say that stuff between < % %> (without the extra spaces…) is executed, that the output of stuff between < %= %> replaces that part, and that partials are also rhtml/erb files, most often in the same directory as the file including it, and their name begins with _.

    (1-3/3)