Prevent sending emails to specific groups

jh May 29, 2012

Can I somehow prevent sending issue create/update email to specific users?

I have A users belonging to a Jira Users group. Then I have B users NOT belonging to it, but having access to projects. So group A can access jira and do whatever they like, group B is able to send emails into the system, but is not able to login.

Fine so far.

Strange is, that group A is getting nicely formatted HTML mails, group B is getting text-style emails. As there IS a difference already, can I somehow disable sending emails to group B fully? I would rather prefer that instead of sending the html emails, as the html emails would still contain links to jira. As they can not login, I would not like sending out the links anyway.

Thanks

4 answers

1 accepted

0 votes
Answer accepted
Verhás István
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2012

Well in this case you can try the following untested code snippet:

#if($jiraUserUtils.getGroupNamesForUser($recipient.getName()).contains("JIRA-USERS-GROUP")) 
## here comes the content with link
#else 
## here comes the content without link
#end


jh June 1, 2012

I'll try that and give you feedback, thanks :)

jh June 1, 2012

It works, perfect!! So, I'll get my mails configured now.... Thanks a lot!

1 vote
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2012

you can restric to send mails by using Notification scheme, find the following document to configure notification scheme

https://confluence.atlassian.com/display/JIRA/Creating+a+Notification+Scheme

jh May 29, 2012

Thanks, I know about this page.

Maybe more clearly:

I want to send out notifications to all reporters, assignees etc..., but NOT if they do / do not belong to a group. I can only choose to send notifications to assignees, but not according to the above filtering.

Any chance?

Thanks!!

0 votes
Verhás István
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2012

At one of our customers we have prosposed for the very same problem the following solution in the template:

#if($recipient.getEmail().endsWith(”yourcompany.com”)) 
## here comes the content with link
#else 
## here comes the content without link
#end

assuming non-jira users can be separated upon the email domain.

jh May 30, 2012

No, that's not the case. There are loads of different email-addresses...

0 votes
Verhás István
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2012

To send email out to group B without links you can edit freely the templates as it is described at https://developer.atlassian.com/display/JIRADEV/Adding+Custom+Fields+to+Email . E.g. drop out the links from the text templates and set group B getting text-style emails.

jh May 30, 2012

This could actually work out!

How would it look like to check if a specific group is set or not? I am sadly not a java-guru to have a good idea.

#if ($issue.getCustomFieldValue("customfield_10000"))
>$stringUtils.leftPad($issue.getCustomField("customfield_10000").name, $padSize): $issue.getCustomFieldValue("customfield_10000")
#end

I should be sonething like:

#if ($issue.isMemberOfGroup("JiraUsers"))
mail content for jira users
#else
mail content for non-jira users #end

How can I test against a group? Thanks a lot!! (We're getting closer, that could solve it, yeaa :-))

Suggest an answer

Log in or Sign up to answer