mirror of
https://github.com/anteo/redmine_custom_workflows.git
synced 2026-01-26 00:04:20 +00:00
Send email to address in custom field? #340
This commit is contained in:
parent
fbbd145c9c
commit
1e40bb9c09
@ -25,15 +25,15 @@ class CustomWorkflowMailer < Mailer
|
|||||||
layout 'mailer'
|
layout 'mailer'
|
||||||
|
|
||||||
def self.deliver_custom_email(user, headers = {})
|
def self.deliver_custom_email(user, headers = {})
|
||||||
custom_email(user, headers).deliver_later
|
custom_email(user, headers, headers.dup).deliver_later
|
||||||
end
|
end
|
||||||
|
|
||||||
def custom_email(user, headers)
|
def custom_email(user, headers, cw_headers)
|
||||||
headers[:to] = user.mail if user
|
headers[:to] ||= user.mail
|
||||||
text_body = headers.delete :text_body
|
text_body = cw_headers[:text_body]
|
||||||
html_body = headers.delete :html_body
|
html_body = cw_headers[:html_body]
|
||||||
template_name = headers.delete :template_name
|
template_name = cw_headers[:template_name]
|
||||||
template_params = headers.delete(:template_params) || {}
|
template_params = cw_headers[:template_params] || {}
|
||||||
if text_body || html_body
|
if text_body || html_body
|
||||||
mail headers do |format|
|
mail headers do |format|
|
||||||
format.text { render plain: text_body } if text_body.present?
|
format.text { render plain: text_body } if text_body.present?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user