Send email of a task with comments

Hi folks!

There is a way to send email of a finished task including all comments on that task?

not out of the box.

you could:
1.) add an automatic action that does it for you
https://docs.kanboard.org/en/latest/plugins/automatic_actions.html

or

2.) override the notification template for the appropriate event (i.e. task close), with your own template to include all the comments.
https://docs.kanboard.org/en/latest/plugins/overrides.html

1 Like

Hello, did you manage to find a solution for this?

which part cant you figure out?

This action sends and email whenever there is a “New Comment” on a task.
I would think it should give you a good baseline to figure out how to send “All comments” when a task is closed.

If you can’t figure it out, let me know.

I will look at it again, Im just getting confused with how to create the action to send an email so that when the task closes, besides sending an email to comment that the task is closed… another email is fired through actions to send the ‘summary’ of the closed task… e.g. description and full comment history.

so do you want 1 email upon task close, with all comments and descriptions, or do you want 2 emails?

I already get an email that a task is closed… through an action…
I need a seperate email with a subject (Task summary) which will consist of the task description with a full history of the comments.

So for this board i would get 2 emails, but for other boards it would depend on which actions i use for that board.

ya that should be pretty simple.

get as far as you can, and then either add me to the repo or send me the code, and i will complete it.

1 Like

am I right or wrong in saying that the only thing to change (in a duplicate file of course) would be:

$this->template->render('commen/show', array(
                            'task' => $data['task'],
                            'comment' => $data['comment'],
                        ))

this wouldďsend ALL the task comments… then to add the description it would be to add 'description' => $data['description'], to the array?

Or have I got it all wrong?

that would be a negative. you want to send all comments, the current action i wrote, is based on when a new comment is created, i.e. the event. That event only carries the data for that comment, its also not your event, that you want. your event is on task close. TaskModel::EVENT_CLOSE

you need to look at a controller that sends data to “comment/show” template, see how they handle that. Probably the TaskViewController, is where that is going to start, and then follow the code until you find exactly what to send to the “comment/show” template, and whether or not you need any iterations, may already be handled with the iterations.

you can see here the beginning of the comment data coming to fruition.

it actually sends the data to “task_comment/show” next, id follow suit if i were you.

from there it takes care of all the iterations for you.

it might seem complicated, but its actually simple, send the exact same data, to the “task_comment/show” template, and then all the comments will be rendered in your email.

the above gives you all the information you need to do that, how to get the data(mostly found in the controller using the $task variable which you have, for $editable just use false), and what to send after you got it(found in the “task/show” template, which sends 4 variables on lines 47-50, you need them all).

thank you so much forŕthe detailed explanation… I have tried my best to understand it with my basic skills…

Please check the code for me here: GitHub - aljawaid/KanboardEmailHistory

I’m trying to create an action so that:
when the task closes:

  1. a comment is added to the task to say that the task history including comments was sent to xyz.
  2. the task description is in the body of the email, followed by the full task history.
1 Like

I fixed what you had, but did not add any features. If you need more help, again, try and let me know when stuck.

1 Like

woah thanks foŕthis… I had a glance, will test when I get home… it seems I was way out lol

1 Like

thats good, because i didnt test it. i see one thing i missed, forgot to add projectmodel in the “use” section.

1 Like

Can you please review my changes? I missed the description, but I think I have fully done it now. I just need you to have a glance at it as you understand the code for Kanboard a lot better than me.

glanced.

commented on your changes. it will need a lot of fixes.

1 Like

I’ve got it working and released the first version. Hope it’s useful to others too.

2 Likes