anteo / redmine_custom_workflows

Allows to create custom workflows for Redmine
http://www.redmine.org/plugins/custom-workflows
GNU General Public License v2.0
178 stars 72 forks source link

Send email to address in custom field? #340

Closed jwr03 closed 3 months ago

jwr03 commented 3 months ago

I have a custom field called end_user_email_address. That is the email address that a Redmine user is submitting an issue on behalf of.
That email address is assumed to be someone who does not have a Redmine account.

Is it possible to use the send email from your custom workflow to send email to the custom field's contents on CLOSE of a issue? I noticed it used the User object which in this case I am not sure would work. Thanks in advance Jeremy

picman commented 3 months ago
CustomWorkflowMailer.deliver_custom_email(nil, to: 'franz.kafka@prague.cz', subject: subject, text_body: text)
jwr03 commented 3 months ago

I tried that as follows and get an error

@subject = "This is a test of the workflow"
@desc = "This is the body I hope Andrew gets this!"
@to =" ***@***.***"
CustomWorkflowMailer.deliver_custom_email(nil, :to => @to, :subject => @subject, :text_body => @desc)

From: Karel Pičman @.> Sent: Wednesday, June 12, 2024 1:49 AM To: anteo/redmine_custom_workflows @.> Cc: Redmond, Jeremy W (HEALTH) @.>; Author @.> Subject: Re: [anteo/redmine_custom_workflows] Send email to address in custom field? (Issue #340)

You don't often get email from @.**@.>. Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

ATTENTION: This email came from an external source. Do not open attachments or click on links from unknown senders or unexpected emails.

CustomWorkflowMailer.deliver_custom_email(nil, to: @.***', subject: subject, text_body: text)

- Reply to this email directly, view it on GitHubhttps://github.com/anteo/redmine_custom_workflows/issues/340#issuecomment-2162156208, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMITT6FKJWRFB2YJJ4MIB4LZG7ONVAVCNFSM6AAAAABJEQJMSKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRSGE2TMMRQHA. You are receiving this because you authored the thread.Message ID: @.**@.>>

picman commented 3 months ago

What version of the plugin do you use?

jwr03 commented 3 months ago

1.0.7 is there a newer version?

From: Karel Pičman @.> Sent: Wednesday, June 12, 2024 8:28 AM To: anteo/redmine_custom_workflows @.> Cc: Redmond, Jeremy W (HEALTH) @.>; Author @.> Subject: Re: [anteo/redmine_custom_workflows] Send email to address in custom field? (Issue #340)

You don't often get email from @.**@.>. Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

ATTENTION: This email came from an external source. Do not open attachments or click on links from unknown senders or unexpected emails.

What version of the plugin do you use?

- Reply to this email directly, view it on GitHubhttps://github.com/anteo/redmine_custom_workflows/issues/340#issuecomment-2162883446, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMITT6DJ5YHA5W4HUAU34OLZHA5EXAVCNFSM6AAAAABJEQJMSKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRSHA4DGNBUGY. You are receiving this because you authored the thread.Message ID: @.**@.>>

picman commented 3 months ago

Use the latest stable release: https://github.com/anteo/redmine_custom_workflows/releases

jwr03 commented 3 months ago

I do really appreciate your help. We upgraded to the latest plugin. (2.1.1)

And we tried a few different variations of the code and still can’t seem to send to a custom email addresses that we hardcode.

My latest attempt is with this code and this code only in the Workflow script executable after saving observable object

@subject = "This is a test of the workflow" @desc = "This is the body I hope Andrew gets this!" @to = @.**@.> CustomWorkflowMailer.deliver_custom_email(nil, :to => @to, :subject => @subject, :text_body => @desc)

No email get sent. ☹

@.***

From: Karel Pičman @.> Sent: Wednesday, June 12, 2024 8:34 AM To: anteo/redmine_custom_workflows @.> Cc: Redmond, Jeremy W (HEALTH) @.>; Author @.> Subject: Re: [anteo/redmine_custom_workflows] Send email to address in custom field? (Issue #340)

You don't often get email from @.**@.>. Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

ATTENTION: This email came from an external source. Do not open attachments or click on links from unknown senders or unexpected emails.

Use the latest stable release: https://github.com/anteo/redmine_custom_workflows/releases

— Reply to this email directly, view it on GitHubhttps://github.com/anteo/redmine_custom_workflows/issues/340#issuecomment-2162894314, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMITT6FZATEXQAHVL7KJH43ZHA52DAVCNFSM6AAAAABJEQJMSKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRSHA4TIMZRGQ. You are receiving this because you authored the thread.Message ID: @.**@.>>

picman commented 3 months ago

You will have to check log/production.log for errors too and also your mail server.

jwr03 commented 3 months ago

I am getting the following in the logs with latest version and adding nil as you mentioned.

/home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:359:in run_task' /home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:350:inblock (3 levels) in create_worker' /home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:341:in loop' /home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:341:inblock (2 levels) in create_worker' /home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in catch' /home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:inblock in create_worker' Error performing ActionMailer::DeliveryJob (Job ID: ec9e3218-bd17-4b8a-bc78-8da259a84a2e) from Async(mailers) in 0.25ms: ArgumentError (First argument has to be a user, was nil): /usr/local/redmine-4.2.1/app/models/mailer.rb:37:in process' /home/redmine/.rvm/gems/ruby-2.5.1/gems/actionmailer-5.2.5/lib/action_mailer/message_delivery.rb:123:inblock in processed_mailer' /home/redmine/.rvm/gems/ruby-2.5.1/gems/actionmailer-5.2.5/lib/action_mailer/message_delivery.rb:122:in tap' /home/redmine/.rvm/gems/ruby-2.5.1/gems/actionmailer-5.2.5/lib/action_mailer/message_delivery.rb:122:inprocessed_mailer' /home/redmine/.rvm/gems/ruby-2.5.1/gems/actionmailer-5.2.5/lib/action_mailer/message_delivery.rb:113:in deliver_now' /home/redmine/.rvm/gems/ruby-2.5.1/gems/actionmailer-5.2.5/lib/action_mailer/delivery_job.rb:16:inperform' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/execution.rb:39:in block in perform_now' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/callbacks.rb:109:inblock in run_callbacks' /home/redmine/.rvm/gems/ruby-2.5.1/gems/i18n-1.8.11/lib/i18n.rb:314:in with_locale' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/translation.rb:9:inblock (2 levels) in ' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/callbacks.rb:118:in instance_exec' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/callbacks.rb:118:inblock in run_callbacks' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/logging.rb:26:in block (4 levels) in <module:Logging>' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/notifications.rb:168:inblock in instrument' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/notifications/instrumenter.rb:23:in instrument' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/notifications.rb:168:ininstrument' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/logging.rb:25:in block (3 levels) in <module:Logging>' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/logging.rb:48:intag_logger' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/logging.rb:22:in block (2 levels) in <module:Logging>' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/callbacks.rb:118:ininstance_exec' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/callbacks.rb:118:in block in run_callbacks' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/callbacks.rb:136:inrun_callbacks' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/execution.rb:38:in perform_now' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/execution.rb:24:inblock in execute' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/callbacks.rb:109:in block in run_callbacks' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/railtie.rb:28:inblock (4 levels) in ' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/execution_wrapper.rb:87:in wrap' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/reloader.rb:73:inblock in wrap' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/execution_wrapper.rb:87:in wrap' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/reloader.rb:72:inwrap' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/railtie.rb:27:in block (3 levels) in <class:Railtie>' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/callbacks.rb:118:ininstance_exec' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/callbacks.rb:118:in block in run_callbacks' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.5/lib/active_support/callbacks.rb:136:inrun_callbacks' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/execution.rb:22:in execute' /home/redmine/.rvm/gems/ruby-2.5.1/gems/activejob-5.2.5/lib/active_job/queue_adapters/async_adapter.rb:70:inperform' /home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:359:in run_task' /home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:350:inblock (3 levels) in create_worker' /home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:341:in loop' /home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:341:inblock (2 levels) in create_worker' /home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in catch' /home/redmine/.rvm/gems/ruby-2.5.1/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:inblock in create_worker'

From: Karel Pičman @.> Sent: Thursday, June 13, 2024 1:23 AM To: anteo/redmine_custom_workflows @.> Cc: Redmond, Jeremy W (HEALTH) @.>; Author @.> Subject: Re: [anteo/redmine_custom_workflows] Send email to address in custom field? (Issue #340)

You don't often get email from @.**@.>. Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification

ATTENTION: This email came from an external source. Do not open attachments or click on links from unknown senders or unexpected emails.

You will have to check log/production.log for errors too and also your mail server.

- Reply to this email directly, view it on GitHubhttps://github.com/anteo/redmine_custom_workflows/issues/340#issuecomment-2164406573, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMITT6AJBERVHEDVFCQU37DZHEUCBAVCNFSM6AAAAABJEQJMSKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRUGQYDMNJXGM. You are receiving this because you authored the thread.Message ID: @.**@.>>

picman commented 3 months ago

Hm, you're right. Fixed in the branch devel.