Feature #5913
Authors name in from address of email notifications
| Status: | New | Start date: | 2010-07-20 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% | |
| Category: | Email notifications | |||
| Target version: | - | |||
| Resolution: |
Description
In mail notification created by Redmine 'FROM' address in headers
is set to Setting.mail_form. It would be useful to add name of
author to this address. You would know who is working on issue
without opening mail. I've changed line in app/models/mailer.rb
in initialize_defaults method:
from Setting.mail_from
to
@author ||= User.current
from "#{@author.name} <#{Setting.mail_form}>"
It seams to work, but I'm not sure if it wont break anything.
History
#1 Updated by Jan Wedekind over 2 years ago
I like that idea. Have you had any bad experience with it?
Also, for clarification: who is identified as User.current? The one currently logged in triggering the action that sends a notification?
#2 Updated by Tudor Spinache over 2 years ago
- File mailer.rb
added - File app_models_mailer.rb.diff
added
I managed to make it work 100% in ver 0.85, however after upgrading to 0.95, because the ruby version changed, the old mailer.rb didn't work anymore. Tested on 1.0.0 but obviously, again with the same result.
I put attached my 0.85 working mailer.rb and the patch I used to make it.
Is it possible that one of the ruby gurus out there to "translate" the mailer.rb or the patch to the latest version of ruby ?
#3 Updated by Thomas Themel 11 months ago
I implemented this for 1.4.1 by just adding one line in models/mailer.rb -
if @author && @author.logged?
redmine_headers 'Sender' => @author.login
end
to
if @author && @author.logged?
redmine_headers 'Sender' => @author.login
from @author.firstname + " " + @author.lastname + " via " + Setting.app_title + "<" + Setting.mail_from + ">"
end
Seems to work well enough for the moment, though of course it would be nicer if this was achievable via configuration instead of patching the code.
#4 Updated by Tudor Spinache 10 months ago
Hi Thomas,
Thanks a lot for your help. Trying to add the same for ver. 2.0.3-1 but got the following in dmesg:
NoMethodError (undefined method `from' for #<Mailer:0xb4b2712c>): app/models/mailer.rb:389:in `mail' app/models/mailer.rb:48:in `issue_add' app/models/mailer.rb:417:in `initialize' app/models/mailer.rb:430:in `method_missing' app/models/issue_observer.rb:20:in `after_create' app/controllers/issues_controller.rb:148:in `create'
This happens when trying to add new issue or update an existing one.
Any help would be mostly appreciated.
Tudor.