Skip to content

Commit

Permalink
Send email to address in custom field? #340
Browse files Browse the repository at this point in the history
  • Loading branch information
picman committed Jun 25, 2024
1 parent fbbd145 commit 1e40bb9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/models/custom_workflow_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ class CustomWorkflowMailer < Mailer
layout 'mailer'

def self.deliver_custom_email(user, headers = {})
custom_email(user, headers).deliver_later
custom_email(user, headers, headers.dup).deliver_later
end

def custom_email(user, headers)
headers[:to] = user.mail if user
text_body = headers.delete :text_body
html_body = headers.delete :html_body
template_name = headers.delete :template_name
template_params = headers.delete(:template_params) || {}
def custom_email(user, headers, cw_headers)
headers[:to] ||= user.mail
text_body = cw_headers[:text_body]
html_body = cw_headers[:html_body]
template_name = cw_headers[:template_name]
template_params = cw_headers[:template_params] || {}
if text_body || html_body
mail headers do |format|
format.text { render plain: text_body } if text_body.present?
Expand Down

0 comments on commit 1e40bb9

Please sign in to comment.