From 84a878d2a54f5a099d8fb1986eb271ec23dd3e47 Mon Sep 17 00:00:00 2001 From: Redmine User Date: Tue, 15 Nov 2016 18:28:52 +0100 Subject: [PATCH] Mailer.mail does not use :from but 'From' as the key for the from-address. #603 The from field is set to "Username ". --- app/controllers/dmsf_controller.rb | 3 ++- app/models/dmsf_mailer.rb | 2 +- app/views/dmsf/email_entries.html.erb | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index 83d2cbe5..106118ab 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -365,7 +365,8 @@ class DmsfController < ApplicationController :zipped_content => zipped_content, :folders => selected_folders, :files => selected_files, - :subject => "#{@project.name} #{l(:label_dmsf_file_plural).downcase}" + :subject => "#{@project.name} #{l(:label_dmsf_file_plural).downcase}", + :from => "#{User.current.name} <#{User.current.mail}>" } render :action => 'email_entries' rescue Exception diff --git a/app/models/dmsf_mailer.rb b/app/models/dmsf_mailer.rb index 70877fd8..1f729091 100644 --- a/app/models/dmsf_mailer.rb +++ b/app/models/dmsf_mailer.rb @@ -61,7 +61,7 @@ class DmsfMailer < Mailer attachments['Documents.zip'] = { :content_type => 'application/zip', :content => zipped_content_data } end mail :to => email_params[:to], :cc => email_params[:cc], - :subject => email_params[:subject], :from => user.mail + :subject => email_params[:subject], 'From' => email_params[:from] end def workflow_notification(user, workflow, revision, subject_id, text1_id, text2_id, notice = nil) diff --git a/app/views/dmsf/email_entries.html.erb b/app/views/dmsf/email_entries.html.erb index d3ebf78f..010baf4b 100644 --- a/app/views/dmsf/email_entries.html.erb +++ b/app/views/dmsf/email_entries.html.erb @@ -32,10 +32,11 @@ <%= hidden_field_tag('email[zipped_content]', @email_params[:zipped_content]) %> <%= hidden_field_tag('email[folders]', @email_params[:folders].to_json) %> <%= hidden_field_tag('email[files]', @email_params[:files].to_json) %> + <%= hidden_field_tag('email[from]', @email_params[:from]) %>

<%= label_tag('', l(:label_email_from)) %> - <%= text_field_tag('email[from]', h(Setting.mail_from), :style => 'width: 90%;', :disabled => true) %> + <%= text_field_tag('email[from_disabled]', @email_params[:from], :style => 'width: 90%;', :disabled => true) %>

<%= label_tag('email[to]', l(:label_email_to)) %>