trying to send mail without recipient results in error 500 #560

This commit is contained in:
Karel Picman 2016-08-25 15:18:27 +02:00
parent cfbae13b56
commit 08cad12de4
2 changed files with 10 additions and 11 deletions

View File

@ -242,14 +242,12 @@ class DmsfController < ApplicationController
def entries_email
if params[:email][:to].strip.blank?
flash.now[:error] = l(:error_email_to_must_be_entered)
render :action => 'email_entries'
return
flash[:error] = l(:error_email_to_must_be_entered)
else
DmsfMailer.send_documents(@project, User.current, params[:email]).deliver
File.delete(params[:email][:zipped_content])
flash[:notice] = l(:notice_email_sent, params[:email][:to])
end
DmsfMailer.send_documents(@project, User.current, params[:email]).deliver
File.delete(params[:email][:zipped_content])
flash[:notice] = l(:notice_email_sent, params[:email][:to])
redirect_to dmsf_folder_path(:id => @project, :folder_id => @folder)
end
@ -460,7 +458,8 @@ class DmsfController < ApplicationController
@email_params = {
:zipped_content => zipped_content,
:folders => selected_folders,
:files => selected_files
:files => selected_files,
:subject => "#{@project.name} #{l(:label_dmsf_file_plural).downcase}"
}
render :action => 'email_entries'
rescue Exception

View File

@ -39,15 +39,15 @@
</p>
<p>
<%= label_tag('email[to]', l(:label_email_to)) %>
<%= text_field_tag('email[to]', @email_params['to'], :style => 'width: 90%;') %>
<%= text_field_tag('email[to]', @email_params[:to], :style => 'width: 90%;', :required => true) %>
</p>
<p>
<%= label_tag('email[cc]', l(:label_email_cc)) %>
<%= text_field_tag('email[cc]', @email_params['cc'], :style => 'width: 90%;') %>
<%= text_field_tag('email[cc]', @email_params[:cc], :style => 'width: 90%;') %>
</p>
<p>
<%= label_tag('email[subject]', l(:label_email_subject)) %>
<%= text_field_tag('email[subject]', @email_params['subject'], :style => 'width: 90%;') %>
<%= text_field_tag('email[subject]', @email_params[:subject], :style => 'width: 90%;') %>
</p>
<p>
<%= label_tag('', l(:label_email_documents)) %>