Answer the question
In order to leave comments, you need to log in
How to send your email when creating a task in Redmine?
Please help me figure out how mail works in conjunction with the task creation hook in Redmine projects.
I understand the hook itself here https://github.com/redmine/redmine/blob/1cd985dd6b...
Next, you need something like this:
module MyMailSender
class Hooks < Redmine::Hook::ViewListener
def controller_issues_new_after_save(context={ })
# как то надо отправить почту на адрес [email protected]
end
end
end
mail('[email protected]', 'My Subject', 'My message');
Answer the question
In order to leave comments, you need to log in
redmine has a method that looks similar to the one in php. Mailer class, method mail.
You can call something like this, but first you need to define the layout
, but this is not a nice way
to patch mailer.rb and add your send method to it, which will collect all the necessary data for sending and call the mail method.
To make it clearer for you, see how, for example, notifications are sent for changes in tasks.
First, the deliver_issue_edit method is called, all users are selected for sending, and for each of them the issue_edit method is called, which collects a letter for sending, the prepared letter is sent by the deliver method
It turned out a little chaotically, but the essence reflects
You can send either using Redmine-specific means (read the documentation) or by inheriting from ActionMailer::Base.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question